Conversation
Whenever the `CloseSelectedItem` action was dispatched and the selected index item's was closed, it was possible for the pane's item to end up different than the new selected index in the `TabSwitcher`. This commit reacts to the `PaneEvent::ActivateItem` event to ensure that the `TabSwitcherDelegate.selected_index` matches the newly active item of its pane.
Update the existing test, `test_close_selected_item`, to ensure that, after clsoing an item, the newly activated item's entry will also be selected in the tab switcher to match the pane's state.
Update `TabSwitcherDelegate.subscribe_to_updates` in order to only sync the selected index when handling a `PaneEvent::RemovedItem` event instead of `PaneEvent::ActivateItem`, as the latter event is triggered everytime the user navigates to a different entry in the Tab Swithcer, while the former event is triggered only when an item is removed from the tab switcher, which is exactly when the bug manifests itself. This commit also removes the `test_close_preserves_selected_position` test, as it was added at a time when the list of matches in the tab switcher was not updated when an item was removed. With the current implementation, I believe it no longer makes sense, as we simply end up in a situation where the selected index does not match the pane's active item. I do believe that not having the list update automatically and move entries around is a better experience, and will try to get another Pull Request in the future to implement this and re-add the test.
HactarCE
added a commit
that referenced
this pull request
Dec 3, 2025
…44101) Closes #43171 Previously the tab switcher only subscribed to events from a single pane so closing tabs in other panes wouldn't cause the tab switcher to update. This PR changes that so the tab switcher subscribes to the whole workspace and thus updates when tabs in other panes are closed. It also modifies the work in #44006 to sync selected index across the whole workspace instead of just the original pane in the case of the all-panes tab switcher. Release Notes: - Fixed all-panes tab switcher not updating in response to changes in other panes
AlpSha
pushed a commit
to AlpSha/zed
that referenced
this pull request
Dec 5, 2025
…ed-industries#44101) Closes zed-industries#43171 Previously the tab switcher only subscribed to events from a single pane so closing tabs in other panes wouldn't cause the tab switcher to update. This PR changes that so the tab switcher subscribes to the whole workspace and thus updates when tabs in other panes are closed. It also modifies the work in zed-industries#44006 to sync selected index across the whole workspace instead of just the original pane in the case of the all-panes tab switcher. Release Notes: - Fixed all-panes tab switcher not updating in response to changes in other panes
CherryWorm
pushed a commit
to CherryWorm/zed
that referenced
this pull request
Dec 16, 2025
…match pane's active item (zed-industries#44006) Whenever an item is removed using the Tab Switcher, the list of matches is automatically updated, which can lead to the order of the elements being updated and changing in comparison to what the user was previously seeing. Unfortunately this can lead to a situation where the selected index, since it wasn't being updated, would end up in a different item than the one that was actually active in the pane. This Pull Request updates the handling of the `PaneEvent::RemovedItem` event so that the `TabSwitcherDelegate.selected_index` field is automatically updated to match the pane's new active item. Seeing as this is being updated, the `test_close_preserves_selected_position` test is also removed, as it no longer makes sense with the current implementation. I believe a better user experience would be to actually not update the order of the matches, simply removing the ones that no longer exist, and keep the selected index position, but will tackle that in a different Pull Request. Closes zed-industries#44005 Release Notes: - Fixed a bug with the tab switcher where, after closing a tab, the selected entry would not match the pane's active item
CherryWorm
pushed a commit
to CherryWorm/zed
that referenced
this pull request
Dec 16, 2025
…ed-industries#44101) Closes zed-industries#43171 Previously the tab switcher only subscribed to events from a single pane so closing tabs in other panes wouldn't cause the tab switcher to update. This PR changes that so the tab switcher subscribes to the whole workspace and thus updates when tabs in other panes are closed. It also modifies the work in zed-industries#44006 to sync selected index across the whole workspace instead of just the original pane in the case of the all-panes tab switcher. Release Notes: - Fixed all-panes tab switcher not updating in response to changes in other panes
someone13574
pushed a commit
to someone13574/zed
that referenced
this pull request
Dec 16, 2025
…match pane's active item (zed-industries#44006) Whenever an item is removed using the Tab Switcher, the list of matches is automatically updated, which can lead to the order of the elements being updated and changing in comparison to what the user was previously seeing. Unfortunately this can lead to a situation where the selected index, since it wasn't being updated, would end up in a different item than the one that was actually active in the pane. This Pull Request updates the handling of the `PaneEvent::RemovedItem` event so that the `TabSwitcherDelegate.selected_index` field is automatically updated to match the pane's new active item. Seeing as this is being updated, the `test_close_preserves_selected_position` test is also removed, as it no longer makes sense with the current implementation. I believe a better user experience would be to actually not update the order of the matches, simply removing the ones that no longer exist, and keep the selected index position, but will tackle that in a different Pull Request. Closes zed-industries#44005 Release Notes: - Fixed a bug with the tab switcher where, after closing a tab, the selected entry would not match the pane's active item
someone13574
pushed a commit
to someone13574/zed
that referenced
this pull request
Dec 16, 2025
…ed-industries#44101) Closes zed-industries#43171 Previously the tab switcher only subscribed to events from a single pane so closing tabs in other panes wouldn't cause the tab switcher to update. This PR changes that so the tab switcher subscribes to the whole workspace and thus updates when tabs in other panes are closed. It also modifies the work in zed-industries#44006 to sync selected index across the whole workspace instead of just the original pane in the case of the all-panes tab switcher. Release Notes: - Fixed all-panes tab switcher not updating in response to changes in other panes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Whenever an item is removed using the Tab Switcher, the list of matches is automatically updated, which can lead to the order of the elements being updated and changing in comparison to what the user was previously seeing. Unfortunately this can lead to a situation where the selected index, since it wasn't being updated, would end up in a different item than the one that was actually active in the pane.
This Pull Request updates the handling of the
PaneEvent::RemovedItemevent so that theTabSwitcherDelegate.selected_indexfield is automatically updated to match the pane's new active item.Seeing as this is being updated, the
test_close_preserves_selected_positiontest is also removed, as it no longer makes sense with the current implementation. I believe a better user experience would be to actually not update the order of the matches, simply removing the ones that no longer exist, and keep the selected index position, but will tackle that in a different Pull Request.Closes #44005
Release Notes: