[PR #16858] Update CommandPalette.cpp to ignore _filterTextChanged on TabSwitchMode #31026

Open
opened 2026-01-31 09:44:39 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/16858

State: closed
Merged: Yes


Summary of the Pull Request

As mentioned in the issue #11146, when the "Next/Prev" command is executed from the command line with a string in the search bar, this is setting always the first tab.

References and Relevant Issues

#11146

Detailed Description of the Pull Request / Additional comments

When using the command "Next/Previous Tab" from the command line, we are creating another tab (as if we are using the keyboard shortcut), and this triggers the _filterTextChanged that resets the index to the first item in because the current mode that it has.

This could be cause because, It seems that it detects as if we are deleting the entered letter or creating an empty string, causing the execution of the mentioned method and resetting its index to 0.

To avoid this, we are making sure that when this action is triggerd and we are in the TabSwitchMode, we should ignore the following execution of the method.

Validation Steps Performed

I tested out the following scenarios:

  1. Performing the action with the keyboard shorcut
  2. Perfoming the action with an empty string
  3. Performing the action with a string in the search bar.

Also validated with the current tests.

https://github.com/microsoft/terminal/assets/40709873/e5748739-2011-4168-866d-fc79cd39fc2d

PR Checklist

**Original Pull Request:** https://github.com/microsoft/terminal/pull/16858 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request As mentioned in the issue [#11146](https://github.com/microsoft/terminal/issues/11146), when the "Next/Prev" command is executed from the command line with a string in the search bar, this is setting always the first tab. ## References and Relevant Issues #11146 ## Detailed Description of the Pull Request / Additional comments When using the command "Next/Previous Tab" from the command line, we are creating another tab (as if we are using the keyboard shortcut), and this triggers the `_filterTextChanged` that resets the index to the first item in because the current mode that it has. This could be cause because, It seems that it detects as if we are deleting the entered letter or creating an empty string, causing the execution of the mentioned method and resetting its index to 0. To avoid this, we are making sure that when this action is triggerd and we are in the `TabSwitchMode`, we should ignore the following execution of the method. ## Validation Steps Performed I tested out the following scenarios: 1. Performing the action with the keyboard shorcut 2. Perfoming the action with an empty string 3. Performing the action with a string in the search bar. Also validated with the current tests. https://github.com/microsoft/terminal/assets/40709873/e5748739-2011-4168-866d-fc79cd39fc2d ## PR Checklist - [X] Closes #11146 - [X] Tests added/passed - [ ] Documentation updated - If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx - [ ] Schema updated (if necessary)
claunia added the pull-request label 2026-01-31 09:44:39 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#31026