Skip to content

Commit

Permalink
Clear all state tracking nested commands when switching command mode (#…
Browse files Browse the repository at this point in the history
…10164)

Went for option 2 proposed here:
#10140 (comment).

Disabling back space in the nested entry didn't felt as the nicest
solution.  Instead now all state that keeps track of nested commands is
cleared when switching beteen modes.

## Validation Steps Performed
- Validated the specified issue is fixed by this change:. now after
  entering a sub command and hitting backspace the palette no longer
  shows the sub command item (here `< Select color scheme...` ).
- Validated that switching between all modes (command line, actions, tab
  search & tab switch) still work as expected.
- Validated as well that all modes still work as expected.

Didn't add unit tests, but happy to try that out if this would be
required.

Closes #10140

(cherry picked from commit dd348dc)
  • Loading branch information
kovdu authored and DHowett committed May 24, 2021
1 parent a3de0d0 commit afd6a87
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cascadia/TerminalApp/CommandPalette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,10 @@ namespace winrt::TerminalApp::implementation
ParsedCommandLineText(L"");
_searchBox().Text(L"");
_searchBox().Select(_searchBox().Text().size(), 0);

_nestedActionStack.Clear();
ParentCommandName(L"");
_currentNestedCommands.Clear();
// Leaving this block of code outside the above if-statement
// guarantees that the correct text is shown for the mode
// whenever _switchToMode is called.
Expand Down

0 comments on commit afd6a87

Please sign in to comment.