Skip to content

Commit

Permalink
Don't dispatch the Toggle Command Palette action to keep the just clo…
Browse files Browse the repository at this point in the history
…sed Command Palette closed. (#10423)

An exception was introduced for the 'Toggle Command Palette' action to **not** being dispatched. Otherwise the command palette that was just closed will become visible again.

## PR Checklist
* [x] Closes #10240
* [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA

## Detailed Description of the Pull Request / Additional comments
- Selecting the `Toggle command palette` item in the command palette will now properly close the command palette.
- Opening and closing the Command Palette through shortcut keys is still working fine.
- Other command palette items are still working fine as well.

(cherry picked from commit 813f385)
  • Loading branch information
kovdu authored and DHowett committed Jul 7, 2021
1 parent 3042ac5 commit 37850bf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/cascadia/TerminalApp/CommandPalette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,13 @@ namespace winrt::TerminalApp::implementation
// palette like the Tab Switcher will be able to have the last laugh.
_close();

_DispatchCommandRequestedHandlers(*this, actionPaletteItem.Command());
// But make an exception for the Toggle Command Palette action: we don't want the dispatch
// make the command palette - that was just closed - visible again.
// All other actions can just be dispatched.
if (actionPaletteItem.Command().ActionAndArgs().Action() != ShortcutAction::ToggleCommandPalette)
{
_DispatchCommandRequestedHandlers(*this, actionPaletteItem.Command());
}

TraceLoggingWrite(
g_hTerminalAppProvider, // handle to TerminalApp tracelogging provider
Expand Down

0 comments on commit 37850bf

Please sign in to comment.