Reuse is_tab_pinned method (#35551)

Release Notes:

- N/A
This commit is contained in:
Joseph T. Lyons 2025-08-03 15:45:26 -04:00 committed by GitHub
parent 4417bfe30b
commit 1b9302d452
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2832,7 +2832,7 @@ impl Pane {
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let tab_count = tab_items.len(); let tab_count = tab_items.len();
if self.pinned_tab_count > tab_count { if self.is_tab_pinned(tab_count) {
log::warn!( log::warn!(
"Pinned tab count ({}) exceeds actual tab count ({}). \ "Pinned tab count ({}) exceeds actual tab count ({}). \
This should not happen. If possible, add reproduction steps, \ This should not happen. If possible, add reproduction steps, \
@ -3062,13 +3062,13 @@ impl Pane {
} }
to_pane.update(cx, |this, _| { to_pane.update(cx, |this, _| {
if to_pane == from_pane { if to_pane == from_pane {
let to_ix = this let actual_ix = this
.items .items
.iter() .iter()
.position(|item| item.item_id() == item_id) .position(|item| item.item_id() == item_id)
.unwrap_or(0); .unwrap_or(0);
let is_pinned_in_to_pane = to_ix < this.pinned_tab_count; let is_pinned_in_to_pane = this.is_tab_pinned(actual_ix);
if !was_pinned_in_from_pane && is_pinned_in_to_pane { if !was_pinned_in_from_pane && is_pinned_in_to_pane {
this.pinned_tab_count += 1; this.pinned_tab_count += 1;