From 4814c4f81d686b3da53bcde951f86c6cb8ea176b Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Wed, 19 Aug 2020 20:02:10 -0500 Subject: [PATCH] Add `togglePaneZoom` to schema, defaults, and sort action names (#7346) #6989 forgot to add `togglePaneZoom` to the schema, so this does that. WHILE I'M HERE: * The action names in the schema and the actual source were both in _random_ order, so I sorted them alphabetically. * I also added an unbound `togglePaneZoom` command to defaults.json, so users can use that command from the cmdpal w/o binding it manually. --- doc/cascadia/profiles.schema.json | 21 +-- src/cascadia/TerminalApp/ActionAndArgs.cpp | 199 ++++++++++----------- src/cascadia/TerminalApp/defaults.json | 1 + 3 files changed, 104 insertions(+), 117 deletions(-) diff --git a/doc/cascadia/profiles.schema.json b/doc/cascadia/profiles.schema.json index d26500bd857..1f28228137a 100644 --- a/doc/cascadia/profiles.schema.json +++ b/doc/cascadia/profiles.schema.json @@ -34,18 +34,24 @@ "ShortcutActionName": { "enum": [ "adjustFontSize", + "closeOtherTabs", "closePane", "closeTab", + "closeTabsAfter", "closeWindow", + "commandPalette", "copy", "duplicateTab", + "find", "moveFocus", "newTab", "nextTab", "openNewTabDropdown", "openSettings", + "openTabColorPicker", "paste", "prevTab", + "renameTab", "resetFontSize", "resizePane", "scrollDown", @@ -53,22 +59,17 @@ "scrollUp", "scrollUpPage", "sendInput", + "setColorScheme", + "setTabColor", "splitPane", "switchToTab", + "tabSwitcher", + "toggleAlwaysOnTop", "toggleFocusMode", "toggleFullscreen", - "toggleAlwaysOnTop", + "togglePaneZoom", "toggleRetroEffect", - "find", - "setColorScheme", - "setTabColor", - "openTabColorPicker", - "renameTab", - "commandPalette", "wt", - "closeOtherTabs", - "closeTabsAfter", - "tabSwitcher", "unbound" ], "type": "string" diff --git a/src/cascadia/TerminalApp/ActionAndArgs.cpp b/src/cascadia/TerminalApp/ActionAndArgs.cpp index 150a31c92ea..cda8332904c 100644 --- a/src/cascadia/TerminalApp/ActionAndArgs.cpp +++ b/src/cascadia/TerminalApp/ActionAndArgs.cpp @@ -7,45 +7,45 @@ #include +static constexpr std::string_view AdjustFontSizeKey{ "adjustFontSize" }; +static constexpr std::string_view CloseOtherTabsKey{ "closeOtherTabs" }; +static constexpr std::string_view ClosePaneKey{ "closePane" }; +static constexpr std::string_view CloseTabKey{ "closeTab" }; +static constexpr std::string_view CloseTabsAfterKey{ "closeTabsAfter" }; +static constexpr std::string_view CloseWindowKey{ "closeWindow" }; static constexpr std::string_view CopyTextKey{ "copy" }; -static constexpr std::string_view PasteTextKey{ "paste" }; -static constexpr std::string_view OpenNewTabDropdownKey{ "openNewTabDropdown" }; static constexpr std::string_view DuplicateTabKey{ "duplicateTab" }; +static constexpr std::string_view ExecuteCommandlineKey{ "wt" }; +static constexpr std::string_view FindKey{ "find" }; +static constexpr std::string_view MoveFocusKey{ "moveFocus" }; static constexpr std::string_view NewTabKey{ "newTab" }; static constexpr std::string_view NewWindowKey{ "newWindow" }; -static constexpr std::string_view CloseWindowKey{ "closeWindow" }; -static constexpr std::string_view CloseTabKey{ "closeTab" }; -static constexpr std::string_view ClosePaneKey{ "closePane" }; -static constexpr std::string_view SwitchtoTabKey{ "switchToTab" }; static constexpr std::string_view NextTabKey{ "nextTab" }; +static constexpr std::string_view OpenNewTabDropdownKey{ "openNewTabDropdown" }; +static constexpr std::string_view OpenSettingsKey{ "openSettings" }; // TODO GH#2557: Add args for OpenSettings +static constexpr std::string_view OpenTabColorPickerKey{ "openTabColorPicker" }; +static constexpr std::string_view PasteTextKey{ "paste" }; static constexpr std::string_view PrevTabKey{ "prevTab" }; -static constexpr std::string_view AdjustFontSizeKey{ "adjustFontSize" }; +static constexpr std::string_view RenameTabKey{ "renameTab" }; static constexpr std::string_view ResetFontSizeKey{ "resetFontSize" }; -static constexpr std::string_view ScrollupKey{ "scrollUp" }; +static constexpr std::string_view ResizePaneKey{ "resizePane" }; static constexpr std::string_view ScrolldownKey{ "scrollDown" }; -static constexpr std::string_view ScrolluppageKey{ "scrollUpPage" }; static constexpr std::string_view ScrolldownpageKey{ "scrollDownPage" }; -static constexpr std::string_view SwitchToTabKey{ "switchToTab" }; -static constexpr std::string_view OpenSettingsKey{ "openSettings" }; // TODO GH#2557: Add args for OpenSettings +static constexpr std::string_view ScrollupKey{ "scrollUp" }; +static constexpr std::string_view ScrolluppageKey{ "scrollUpPage" }; static constexpr std::string_view SendInputKey{ "sendInput" }; -static constexpr std::string_view SplitPaneKey{ "splitPane" }; -static constexpr std::string_view TogglePaneZoomKey{ "togglePaneZoom" }; -static constexpr std::string_view ResizePaneKey{ "resizePane" }; -static constexpr std::string_view MoveFocusKey{ "moveFocus" }; -static constexpr std::string_view FindKey{ "find" }; -static constexpr std::string_view ToggleRetroEffectKey{ "toggleRetroEffect" }; -static constexpr std::string_view ToggleFocusModeKey{ "toggleFocusMode" }; -static constexpr std::string_view ToggleFullscreenKey{ "toggleFullscreen" }; -static constexpr std::string_view ToggleAlwaysOnTopKey{ "toggleAlwaysOnTop" }; static constexpr std::string_view SetColorSchemeKey{ "setColorScheme" }; static constexpr std::string_view SetTabColorKey{ "setTabColor" }; -static constexpr std::string_view OpenTabColorPickerKey{ "openTabColorPicker" }; -static constexpr std::string_view RenameTabKey{ "renameTab" }; -static constexpr std::string_view ExecuteCommandlineKey{ "wt" }; +static constexpr std::string_view SplitPaneKey{ "splitPane" }; +static constexpr std::string_view SwitchtoTabKey{ "switchToTab" }; +static constexpr std::string_view SwitchToTabKey{ "switchToTab" }; +static constexpr std::string_view TabSwitcherKey{ "tabSwitcher" }; +static constexpr std::string_view ToggleAlwaysOnTopKey{ "toggleAlwaysOnTop" }; static constexpr std::string_view ToggleCommandPaletteKey{ "commandPalette" }; -static constexpr std::string_view CloseOtherTabsKey{ "closeOtherTabs" }; -static constexpr std::string_view CloseTabsAfterKey{ "closeTabsAfter" }; -static constexpr std::string_view ToggleTabSwitcherKey{ "tabSwitcher" }; +static constexpr std::string_view ToggleFocusModeKey{ "toggleFocusMode" }; +static constexpr std::string_view ToggleFullscreenKey{ "toggleFullscreen" }; +static constexpr std::string_view TogglePaneZoomKey{ "togglePaneZoom" }; +static constexpr std::string_view ToggleRetroEffectKey{ "toggleRetroEffect" }; static constexpr std::string_view ActionKey{ "action" }; @@ -65,45 +65,45 @@ namespace winrt::TerminalApp::implementation // the map are all const for the lifetime of the app, we have nothing to worry // about here. const std::map> ActionAndArgs::ActionKeyNamesMap{ + { AdjustFontSizeKey, ShortcutAction::AdjustFontSize }, + { CloseOtherTabsKey, ShortcutAction::CloseOtherTabs }, + { ClosePaneKey, ShortcutAction::ClosePane }, + { CloseTabKey, ShortcutAction::CloseTab }, + { CloseTabsAfterKey, ShortcutAction::CloseTabsAfter }, + { CloseWindowKey, ShortcutAction::CloseWindow }, { CopyTextKey, ShortcutAction::CopyText }, - { PasteTextKey, ShortcutAction::PasteText }, - { OpenNewTabDropdownKey, ShortcutAction::OpenNewTabDropdown }, { DuplicateTabKey, ShortcutAction::DuplicateTab }, + { ExecuteCommandlineKey, ShortcutAction::ExecuteCommandline }, + { FindKey, ShortcutAction::Find }, + { MoveFocusKey, ShortcutAction::MoveFocus }, { NewTabKey, ShortcutAction::NewTab }, { NewWindowKey, ShortcutAction::NewWindow }, - { CloseWindowKey, ShortcutAction::CloseWindow }, - { CloseTabKey, ShortcutAction::CloseTab }, - { ClosePaneKey, ShortcutAction::ClosePane }, { NextTabKey, ShortcutAction::NextTab }, + { OpenNewTabDropdownKey, ShortcutAction::OpenNewTabDropdown }, + { OpenSettingsKey, ShortcutAction::OpenSettings }, + { OpenTabColorPickerKey, ShortcutAction::OpenTabColorPicker }, + { PasteTextKey, ShortcutAction::PasteText }, { PrevTabKey, ShortcutAction::PrevTab }, - { AdjustFontSizeKey, ShortcutAction::AdjustFontSize }, + { RenameTabKey, ShortcutAction::RenameTab }, { ResetFontSizeKey, ShortcutAction::ResetFontSize }, - { ScrollupKey, ShortcutAction::ScrollUp }, + { ResizePaneKey, ShortcutAction::ResizePane }, { ScrolldownKey, ShortcutAction::ScrollDown }, - { ScrolluppageKey, ShortcutAction::ScrollUpPage }, { ScrolldownpageKey, ShortcutAction::ScrollDownPage }, - { SwitchToTabKey, ShortcutAction::SwitchToTab }, - { ResizePaneKey, ShortcutAction::ResizePane }, - { MoveFocusKey, ShortcutAction::MoveFocus }, - { OpenSettingsKey, ShortcutAction::OpenSettings }, + { ScrollupKey, ShortcutAction::ScrollUp }, + { ScrolluppageKey, ShortcutAction::ScrollUpPage }, + { SendInputKey, ShortcutAction::SendInput }, { SetColorSchemeKey, ShortcutAction::SetColorScheme }, - { ToggleRetroEffectKey, ShortcutAction::ToggleRetroEffect }, + { SetTabColorKey, ShortcutAction::SetTabColor }, + { SplitPaneKey, ShortcutAction::SplitPane }, + { SwitchToTabKey, ShortcutAction::SwitchToTab }, + { TabSwitcherKey, ShortcutAction::ToggleTabSwitcher }, + { ToggleAlwaysOnTopKey, ShortcutAction::ToggleAlwaysOnTop }, + { ToggleCommandPaletteKey, ShortcutAction::ToggleCommandPalette }, { ToggleFocusModeKey, ShortcutAction::ToggleFocusMode }, { ToggleFullscreenKey, ShortcutAction::ToggleFullscreen }, - { ToggleAlwaysOnTopKey, ShortcutAction::ToggleAlwaysOnTop }, - { SendInputKey, ShortcutAction::SendInput }, - { SplitPaneKey, ShortcutAction::SplitPane }, { TogglePaneZoomKey, ShortcutAction::TogglePaneZoom }, - { SetTabColorKey, ShortcutAction::SetTabColor }, - { OpenTabColorPickerKey, ShortcutAction::OpenTabColorPicker }, + { ToggleRetroEffectKey, ShortcutAction::ToggleRetroEffect }, { UnboundKey, ShortcutAction::Invalid }, - { FindKey, ShortcutAction::Find }, - { RenameTabKey, ShortcutAction::RenameTab }, - { ExecuteCommandlineKey, ShortcutAction::ExecuteCommandline }, - { ToggleCommandPaletteKey, ShortcutAction::ToggleCommandPalette }, - { CloseOtherTabsKey, ShortcutAction::CloseOtherTabs }, - { CloseTabsAfterKey, ShortcutAction::CloseTabsAfter }, - { ToggleTabSwitcherKey, ShortcutAction::ToggleTabSwitcher }, }; using ParseResult = std::tuple>; @@ -115,37 +115,22 @@ namespace winrt::TerminalApp::implementation // placed into this map, with the corresponding deserializer function as the // value. static const std::map> argParsers{ - { ShortcutAction::CopyText, winrt::TerminalApp::implementation::CopyTextArgs::FromJson }, - - { ShortcutAction::NewTab, winrt::TerminalApp::implementation::NewTabArgs::FromJson }, - - { ShortcutAction::SwitchToTab, winrt::TerminalApp::implementation::SwitchToTabArgs::FromJson }, - - { ShortcutAction::ResizePane, winrt::TerminalApp::implementation::ResizePaneArgs::FromJson }, - - { ShortcutAction::MoveFocus, winrt::TerminalApp::implementation::MoveFocusArgs::FromJson }, - - { ShortcutAction::AdjustFontSize, winrt::TerminalApp::implementation::AdjustFontSizeArgs::FromJson }, - - { ShortcutAction::SendInput, winrt::TerminalApp::implementation::SendInputArgs::FromJson }, - - { ShortcutAction::SplitPane, winrt::TerminalApp::implementation::SplitPaneArgs::FromJson }, - - { ShortcutAction::OpenSettings, winrt::TerminalApp::implementation::OpenSettingsArgs::FromJson }, - - { ShortcutAction::SetColorScheme, winrt::TerminalApp::implementation::SetColorSchemeArgs::FromJson }, - - { ShortcutAction::SetTabColor, winrt::TerminalApp::implementation::SetTabColorArgs::FromJson }, - - { ShortcutAction::RenameTab, winrt::TerminalApp::implementation::RenameTabArgs::FromJson }, - - { ShortcutAction::ExecuteCommandline, winrt::TerminalApp::implementation::ExecuteCommandlineArgs::FromJson }, - - { ShortcutAction::CloseOtherTabs, winrt::TerminalApp::implementation::CloseOtherTabsArgs::FromJson }, - - { ShortcutAction::CloseTabsAfter, winrt::TerminalApp::implementation::CloseTabsAfterArgs::FromJson }, - - { ShortcutAction::ToggleTabSwitcher, winrt::TerminalApp::implementation::ToggleTabSwitcherArgs::FromJson }, + { ShortcutAction::AdjustFontSize, AdjustFontSizeArgs::FromJson }, + { ShortcutAction::CloseOtherTabs, CloseOtherTabsArgs::FromJson }, + { ShortcutAction::CloseTabsAfter, CloseTabsAfterArgs::FromJson }, + { ShortcutAction::CopyText, CopyTextArgs::FromJson }, + { ShortcutAction::ExecuteCommandline, ExecuteCommandlineArgs::FromJson }, + { ShortcutAction::MoveFocus, MoveFocusArgs::FromJson }, + { ShortcutAction::NewTab, NewTabArgs::FromJson }, + { ShortcutAction::OpenSettings, OpenSettingsArgs::FromJson }, + { ShortcutAction::RenameTab, RenameTabArgs::FromJson }, + { ShortcutAction::ResizePane, ResizePaneArgs::FromJson }, + { ShortcutAction::SendInput, SendInputArgs::FromJson }, + { ShortcutAction::SetColorScheme, SetColorSchemeArgs::FromJson }, + { ShortcutAction::SetTabColor, SetTabColorArgs::FromJson }, + { ShortcutAction::SplitPane, SplitPaneArgs::FromJson }, + { ShortcutAction::SwitchToTab, SwitchToTabArgs::FromJson }, + { ShortcutAction::ToggleTabSwitcher, ToggleTabSwitcherArgs::FromJson }, { ShortcutAction::Invalid, nullptr }, }; @@ -263,44 +248,44 @@ namespace winrt::TerminalApp::implementation // to load the resources at _init_, only at runtime. static const auto GeneratedActionNames = []() { return std::unordered_map{ + { ShortcutAction::AdjustFontSize, RS_(L"AdjustFontSizeCommandKey") }, + { ShortcutAction::CloseOtherTabs, L"" }, // Intentionally omitted, must be generated by GenerateName + { ShortcutAction::ClosePane, RS_(L"ClosePaneCommandKey") }, + { ShortcutAction::CloseTab, RS_(L"CloseTabCommandKey") }, + { ShortcutAction::CloseTabsAfter, L"" }, // Intentionally omitted, must be generated by GenerateName + { ShortcutAction::CloseWindow, RS_(L"CloseWindowCommandKey") }, { ShortcutAction::CopyText, RS_(L"CopyTextCommandKey") }, - { ShortcutAction::PasteText, RS_(L"PasteTextCommandKey") }, - { ShortcutAction::OpenNewTabDropdown, RS_(L"OpenNewTabDropdownCommandKey") }, { ShortcutAction::DuplicateTab, RS_(L"DuplicateTabCommandKey") }, + { ShortcutAction::ExecuteCommandline, RS_(L"ExecuteCommandlineCommandKey") }, + { ShortcutAction::Find, RS_(L"FindCommandKey") }, + { ShortcutAction::Invalid, L"" }, + { ShortcutAction::MoveFocus, RS_(L"MoveFocusCommandKey") }, { ShortcutAction::NewTab, RS_(L"NewTabCommandKey") }, { ShortcutAction::NewWindow, RS_(L"NewWindowCommandKey") }, - { ShortcutAction::CloseWindow, RS_(L"CloseWindowCommandKey") }, - { ShortcutAction::CloseTab, RS_(L"CloseTabCommandKey") }, - { ShortcutAction::ClosePane, RS_(L"ClosePaneCommandKey") }, { ShortcutAction::NextTab, RS_(L"NextTabCommandKey") }, + { ShortcutAction::OpenNewTabDropdown, RS_(L"OpenNewTabDropdownCommandKey") }, + { ShortcutAction::OpenSettings, RS_(L"OpenSettingsCommandKey") }, + { ShortcutAction::OpenTabColorPicker, RS_(L"OpenTabColorPickerCommandKey") }, + { ShortcutAction::PasteText, RS_(L"PasteTextCommandKey") }, { ShortcutAction::PrevTab, RS_(L"PrevTabCommandKey") }, - { ShortcutAction::AdjustFontSize, RS_(L"AdjustFontSizeCommandKey") }, + { ShortcutAction::RenameTab, RS_(L"ResetTabNameCommandKey") }, { ShortcutAction::ResetFontSize, RS_(L"ResetFontSizeCommandKey") }, - { ShortcutAction::ScrollUp, RS_(L"ScrollUpCommandKey") }, + { ShortcutAction::ResizePane, RS_(L"ResizePaneCommandKey") }, { ShortcutAction::ScrollDown, RS_(L"ScrollDownCommandKey") }, - { ShortcutAction::ScrollUpPage, RS_(L"ScrollUpPageCommandKey") }, { ShortcutAction::ScrollDownPage, RS_(L"ScrollDownPageCommandKey") }, - { ShortcutAction::SwitchToTab, RS_(L"SwitchToTabCommandKey") }, - { ShortcutAction::ResizePane, RS_(L"ResizePaneCommandKey") }, - { ShortcutAction::MoveFocus, RS_(L"MoveFocusCommandKey") }, - { ShortcutAction::OpenSettings, RS_(L"OpenSettingsCommandKey") }, - { ShortcutAction::ToggleRetroEffect, RS_(L"ToggleRetroEffectCommandKey") }, - { ShortcutAction::ToggleFocusMode, RS_(L"ToggleFocusModeCommandKey") }, - { ShortcutAction::ToggleFullscreen, RS_(L"ToggleFullscreenCommandKey") }, - { ShortcutAction::ToggleAlwaysOnTop, RS_(L"ToggleAlwaysOnTopCommandKey") }, + { ShortcutAction::ScrollUp, RS_(L"ScrollUpCommandKey") }, + { ShortcutAction::ScrollUpPage, RS_(L"ScrollUpPageCommandKey") }, { ShortcutAction::SendInput, L"" }, - { ShortcutAction::SplitPane, RS_(L"SplitPaneCommandKey") }, - { ShortcutAction::TogglePaneZoom, RS_(L"TogglePaneZoomCommandKey") }, - { ShortcutAction::Invalid, L"" }, - { ShortcutAction::Find, RS_(L"FindCommandKey") }, { ShortcutAction::SetColorScheme, L"" }, { ShortcutAction::SetTabColor, RS_(L"ResetTabColorCommandKey") }, - { ShortcutAction::OpenTabColorPicker, RS_(L"OpenTabColorPickerCommandKey") }, - { ShortcutAction::RenameTab, RS_(L"ResetTabNameCommandKey") }, - { ShortcutAction::ExecuteCommandline, RS_(L"ExecuteCommandlineCommandKey") }, + { ShortcutAction::SplitPane, RS_(L"SplitPaneCommandKey") }, + { ShortcutAction::SwitchToTab, RS_(L"SwitchToTabCommandKey") }, + { ShortcutAction::ToggleAlwaysOnTop, RS_(L"ToggleAlwaysOnTopCommandKey") }, { ShortcutAction::ToggleCommandPalette, RS_(L"ToggleCommandPaletteCommandKey") }, - { ShortcutAction::CloseOtherTabs, L"" }, // Intentionally omitted, must be generated by GenerateName - { ShortcutAction::CloseTabsAfter, L"" }, // Intentionally omitted, must be generated by GenerateName + { ShortcutAction::ToggleFocusMode, RS_(L"ToggleFocusModeCommandKey") }, + { ShortcutAction::ToggleFullscreen, RS_(L"ToggleFullscreenCommandKey") }, + { ShortcutAction::TogglePaneZoom, RS_(L"TogglePaneZoomCommandKey") }, + { ShortcutAction::ToggleRetroEffect, RS_(L"ToggleRetroEffectCommandKey") }, }; }(); diff --git a/src/cascadia/TerminalApp/defaults.json b/src/cascadia/TerminalApp/defaults.json index d4f6b40839d..4a272e4d0c6 100644 --- a/src/cascadia/TerminalApp/defaults.json +++ b/src/cascadia/TerminalApp/defaults.json @@ -324,6 +324,7 @@ { "command": { "action": "moveFocus", "direction": "left" }, "keys": "alt+left" }, { "command": { "action": "moveFocus", "direction": "right" }, "keys": "alt+right" }, { "command": { "action": "moveFocus", "direction": "up" }, "keys": "alt+up" }, + { "command": "togglePaneZoom" }, // Clipboard Integration { "command": { "action": "copy", "singleLine": false }, "keys": "ctrl+shift+c" },