From 35f96459df5442e1b7a57baf00cb078ad01c2179 Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Fri, 6 Nov 2020 11:45:10 -0500 Subject: [PATCH 01/21] initial --- src/cascadia/TerminalApp/Pane.cpp | 26 ++++++++++++++++++++ src/cascadia/TerminalApp/Pane.h | 6 +++++ src/cascadia/TerminalApp/TerminalTab.cpp | 30 +++++++++++++++++++++++- src/cascadia/TerminalApp/TerminalTab.h | 3 +++ 4 files changed, 64 insertions(+), 1 deletion(-) diff --git a/src/cascadia/TerminalApp/Pane.cpp b/src/cascadia/TerminalApp/Pane.cpp index b561ea6acd3..1be663ed3f7 100644 --- a/src/cascadia/TerminalApp/Pane.cpp +++ b/src/cascadia/TerminalApp/Pane.cpp @@ -1566,6 +1566,32 @@ void Pane::Restore(std::shared_ptr zoomedPane) } } +uint16_t Pane::GetPaneId() noexcept +{ + return _paneId; +} + +void Pane::SetPaneId(uint16_t id) noexcept +{ + _paneId = id; +} + +void Pane::FocusPaneWithId(const uint16_t id) +{ + if (_IsLeaf() && id == _paneId) + { + _control.Focus(FocusState::Programmatic); + } + else + { + if (_firstChild && _secondChild) + { + _firstChild->FocusPaneWithId(id); + _secondChild->FocusPaneWithId(id); + } + } +} + // Method Description: // - Gets the size in pixels of each of our children, given the full size they // should fill. Since these children own their own separators (borders), this diff --git a/src/cascadia/TerminalApp/Pane.h b/src/cascadia/TerminalApp/Pane.h index 925dd436c9a..4eb6ae1277f 100644 --- a/src/cascadia/TerminalApp/Pane.h +++ b/src/cascadia/TerminalApp/Pane.h @@ -75,6 +75,10 @@ class Pane : public std::enable_shared_from_this void Maximize(std::shared_ptr zoomedPane); void Restore(std::shared_ptr zoomedPane); + uint16_t GetPaneId() noexcept; + void SetPaneId(uint16_t id) noexcept; + void FocusPaneWithId(const uint16_t id); + WINRT_CALLBACK(Closed, winrt::Windows::Foundation::EventHandler); DECLARE_EVENT(GotFocus, _GotFocusHandlers, winrt::delegate>); DECLARE_EVENT(PaneRaiseVisualBell, _PaneRaiseVisualBellHandlers, winrt::delegate>); @@ -95,6 +99,8 @@ class Pane : public std::enable_shared_from_this winrt::Microsoft::Terminal::Settings::Model::SplitState _splitState{ winrt::Microsoft::Terminal::Settings::Model::SplitState::None }; float _desiredSplitPosition; + uint16_t _paneId; + bool _lastActive{ false }; std::optional _profile{ std::nullopt }; winrt::event_token _connectionStateChangedToken{ 0 }; diff --git a/src/cascadia/TerminalApp/TerminalTab.cpp b/src/cascadia/TerminalApp/TerminalTab.cpp index e50c5de89e0..c124526c3d7 100644 --- a/src/cascadia/TerminalApp/TerminalTab.cpp +++ b/src/cascadia/TerminalApp/TerminalTab.cpp @@ -24,10 +24,15 @@ namespace winrt namespace winrt::TerminalApp::implementation { - TerminalTab::TerminalTab(const GUID& profile, const TermControl& control) + TerminalTab::TerminalTab(const GUID& profile, const TermControl& control) : + _mruPanes{ winrt::single_threaded_vector() } { _rootPane = std::make_shared(profile, control, true); + _rootPane->SetPaneId(_nextPaneId); + _mruPanes.InsertAt(0, _nextPaneId); + ++_nextPaneId; + _rootPane->Closed([=](auto&& /*s*/, auto&& /*e*/) { _ClosedHandlers(nullptr, nullptr); }); @@ -274,7 +279,11 @@ namespace winrt::TerminalApp::implementation // - void TerminalTab::SplitPane(SplitState splitType, const GUID& profile, TermControl& control) { + const auto activePaneId = _activePane->GetPaneId(); auto [first, second] = _activePane->Split(splitType, profile, control); + first->SetPaneId(activePaneId); + second->SetPaneId(_nextPaneId); + ++_nextPaneId; _activePane = first; _AttachEventHandlersToControl(control); @@ -337,6 +346,7 @@ namespace winrt::TerminalApp::implementation // NOTE: This _must_ be called on the root pane, so that it can propagate // throughout the entire tree. _rootPane->NavigateFocus(direction); + //_rootPane->FocusPaneWithId(_mruPanes.GetAt(1)); } // Method Description: @@ -450,6 +460,16 @@ namespace winrt::TerminalApp::implementation // Update our own title text to match the newly-active pane. UpdateTitle(); + // We need to move the pane to the top of our mru list + // If its already somewhere in the list, remove it first + uint32_t mruPaneIndex; + const auto paneId = pane->GetPaneId(); + if (_mruPanes.IndexOf(paneId, mruPaneIndex)) + { + _mruPanes.RemoveAt(mruPaneIndex); + } + _mruPanes.InsertAt(0, paneId); + // Raise our own ActivePaneChanged event. _ActivePaneChangedHandlers(); } @@ -484,6 +504,14 @@ namespace winrt::TerminalApp::implementation pane->Closed([weakThis](auto&& /*s*/, auto && /*e*/) -> winrt::fire_and_forget { if (auto tab{ weakThis.get() }) { + //if (auto pane{ s.try_as() }) + //{ + // uint32_t mruIndex; + // if (tab->_mruPanes.IndexOf(pane.GetPaneId(), mruIndex)) + // { + // tab->_mruPanes.RemoveAt(mruIndex); + // } + //} if (tab->_zoomedPane) { co_await winrt::resume_foreground(tab->Content().Dispatcher()); diff --git a/src/cascadia/TerminalApp/TerminalTab.h b/src/cascadia/TerminalApp/TerminalTab.h index b228b45a1de..a8f328f2e8a 100644 --- a/src/cascadia/TerminalApp/TerminalTab.h +++ b/src/cascadia/TerminalApp/TerminalTab.h @@ -83,6 +83,9 @@ namespace winrt::TerminalApp::implementation winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _closeTabsAfterMenuItem{}; winrt::TerminalApp::TabHeaderControl _headerControl{}; + Windows::Foundation::Collections::IVector _mruPanes; + uint16_t _nextPaneId{ 0 }; + bool _receivedKeyDown{ false }; winrt::hstring _runtimeTabText{}; From c1d545790c07cad22ee7c35261c805274ee49955 Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Fri, 6 Nov 2020 16:20:19 -0500 Subject: [PATCH 02/21] add keybinding --- src/cascadia/TerminalApp/TerminalTab.cpp | 34 ++++++++++++------- .../TerminalSettingsModel/ActionArgs.idl | 3 +- .../TerminalSettingsSerializationHelpers.h | 3 +- .../TerminalSettingsModel/defaults.json | 1 + 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/cascadia/TerminalApp/TerminalTab.cpp b/src/cascadia/TerminalApp/TerminalTab.cpp index c124526c3d7..ec542009912 100644 --- a/src/cascadia/TerminalApp/TerminalTab.cpp +++ b/src/cascadia/TerminalApp/TerminalTab.cpp @@ -343,10 +343,17 @@ namespace winrt::TerminalApp::implementation // - void TerminalTab::NavigateFocus(const Direction& direction) { - // NOTE: This _must_ be called on the root pane, so that it can propagate - // throughout the entire tree. - _rootPane->NavigateFocus(direction); - //_rootPane->FocusPaneWithId(_mruPanes.GetAt(1)); + if (direction == Direction::Previous) + { + // To get to the previous pane, get the id of the previous pane and focus to that + _rootPane->FocusPaneWithId(_mruPanes.GetAt(1)); + } + else + { + // NOTE: This _must_ be called on the root pane, so that it can propagate + // throughout the entire tree. + _rootPane->NavigateFocus(direction); + } } // Method Description: @@ -486,6 +493,7 @@ namespace winrt::TerminalApp::implementation void TerminalTab::_AttachEventHandlersToPane(std::shared_ptr pane) { auto weakThis{ get_weak() }; + std::weak_ptr weakPane{ pane }; pane->GotFocus([weakThis](std::shared_ptr sender) { // Do nothing if the Tab's lifetime is expired or pane isn't new. @@ -501,17 +509,9 @@ namespace winrt::TerminalApp::implementation // Add a Closed event handler to the Pane. If the pane closes out from // underneath us, and it's zoomed, we want to be able to make sure to // update our state accordingly to un-zoom that pane. See GH#7252. - pane->Closed([weakThis](auto&& /*s*/, auto && /*e*/) -> winrt::fire_and_forget { + pane->Closed([weakThis, weakPane](auto&& /*s*/, auto && /*e*/) -> winrt::fire_and_forget { if (auto tab{ weakThis.get() }) { - //if (auto pane{ s.try_as() }) - //{ - // uint32_t mruIndex; - // if (tab->_mruPanes.IndexOf(pane.GetPaneId(), mruIndex)) - // { - // tab->_mruPanes.RemoveAt(mruIndex); - // } - //} if (tab->_zoomedPane) { co_await winrt::resume_foreground(tab->Content().Dispatcher()); @@ -519,6 +519,14 @@ namespace winrt::TerminalApp::implementation tab->Content(tab->_rootPane->GetRootElement()); tab->ExitZoom(); } + if (auto pane = weakPane.lock()) + { + uint32_t mruIndex; + if (tab->_mruPanes.IndexOf(pane->GetPaneId(), mruIndex)) + { + tab->_mruPanes.RemoveAt(mruIndex); + } + } } }); diff --git a/src/cascadia/TerminalSettingsModel/ActionArgs.idl b/src/cascadia/TerminalSettingsModel/ActionArgs.idl index 5e93449d0b8..6b614cf7119 100644 --- a/src/cascadia/TerminalSettingsModel/ActionArgs.idl +++ b/src/cascadia/TerminalSettingsModel/ActionArgs.idl @@ -22,7 +22,8 @@ namespace Microsoft.Terminal.Settings.Model Left, Right, Up, - Down + Down, + Previous }; enum SplitState diff --git a/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h b/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h index afecac6b08b..30d92a73bdd 100644 --- a/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h +++ b/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h @@ -333,11 +333,12 @@ struct ::Microsoft::Terminal::Settings::Model::JsonUtils::ConversionTrait<::winr // Possible Direction values JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::Direction) { - JSON_MAPPINGS(4) = { + JSON_MAPPINGS(5) = { pair_type{ "left", ValueType::Left }, pair_type{ "right", ValueType::Right }, pair_type{ "up", ValueType::Up }, pair_type{ "down", ValueType::Down }, + pair_type{ "previous", ValueType::Previous }, }; }; diff --git a/src/cascadia/TerminalSettingsModel/defaults.json b/src/cascadia/TerminalSettingsModel/defaults.json index 88266099002..79bd7ef14b1 100644 --- a/src/cascadia/TerminalSettingsModel/defaults.json +++ b/src/cascadia/TerminalSettingsModel/defaults.json @@ -331,6 +331,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": { "action": "moveFocus", "direction": "previous" }, "keys": "ctrl+shift+right" }, { "command": "togglePaneZoom" }, // Clipboard Integration From 1287f8ddc08cd02f9c553e9337755201e693c1ff Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Fri, 6 Nov 2020 16:32:20 -0500 Subject: [PATCH 03/21] support for moving to first focused pane --- src/cascadia/TerminalApp/TerminalTab.cpp | 4 ++++ src/cascadia/TerminalSettingsModel/ActionArgs.idl | 3 ++- .../TerminalSettingsSerializationHelpers.h | 3 ++- src/cascadia/TerminalSettingsModel/defaults.json | 3 ++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/cascadia/TerminalApp/TerminalTab.cpp b/src/cascadia/TerminalApp/TerminalTab.cpp index ec542009912..74c11107042 100644 --- a/src/cascadia/TerminalApp/TerminalTab.cpp +++ b/src/cascadia/TerminalApp/TerminalTab.cpp @@ -348,6 +348,10 @@ namespace winrt::TerminalApp::implementation // To get to the previous pane, get the id of the previous pane and focus to that _rootPane->FocusPaneWithId(_mruPanes.GetAt(1)); } + else if (direction == Direction::Next) + { + _rootPane->FocusPaneWithId(_mruPanes.GetAt(_mruPanes.Size() - 1)); + } else { // NOTE: This _must_ be called on the root pane, so that it can propagate diff --git a/src/cascadia/TerminalSettingsModel/ActionArgs.idl b/src/cascadia/TerminalSettingsModel/ActionArgs.idl index 6b614cf7119..c6a7e5e8b91 100644 --- a/src/cascadia/TerminalSettingsModel/ActionArgs.idl +++ b/src/cascadia/TerminalSettingsModel/ActionArgs.idl @@ -23,7 +23,8 @@ namespace Microsoft.Terminal.Settings.Model Right, Up, Down, - Previous + Previous, + Next }; enum SplitState diff --git a/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h b/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h index 30d92a73bdd..135d4466246 100644 --- a/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h +++ b/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h @@ -333,12 +333,13 @@ struct ::Microsoft::Terminal::Settings::Model::JsonUtils::ConversionTrait<::winr // Possible Direction values JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::Direction) { - JSON_MAPPINGS(5) = { + JSON_MAPPINGS(6) = { pair_type{ "left", ValueType::Left }, pair_type{ "right", ValueType::Right }, pair_type{ "up", ValueType::Up }, pair_type{ "down", ValueType::Down }, pair_type{ "previous", ValueType::Previous }, + pair_type{ "next", ValueType::Next }, }; }; diff --git a/src/cascadia/TerminalSettingsModel/defaults.json b/src/cascadia/TerminalSettingsModel/defaults.json index 79bd7ef14b1..09d0f3df0eb 100644 --- a/src/cascadia/TerminalSettingsModel/defaults.json +++ b/src/cascadia/TerminalSettingsModel/defaults.json @@ -331,7 +331,8 @@ { "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": { "action": "moveFocus", "direction": "previous" }, "keys": "ctrl+shift+right" }, + { "command": { "action": "moveFocus", "direction": "previous" }, "keys": "ctrl+shift+left" }, + { "command": { "action": "moveFocus", "direction": "next" }, "keys": "ctrl+shift+right" }, { "command": "togglePaneZoom" }, // Clipboard Integration From c30eba47c1c5a19176c4643d6d7abe85fec5bfd0 Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Mon, 9 Nov 2020 10:56:53 -0500 Subject: [PATCH 04/21] address comments --- doc/cascadia/profiles.schema.json | 8 ++++--- src/cascadia/TerminalApp/Pane.cpp | 23 +++++++++++++++---- src/cascadia/TerminalApp/Pane.h | 6 ++--- src/cascadia/TerminalApp/TerminalTab.cpp | 16 ++++++------- .../TerminalSettingsModel/defaults.json | 4 ++-- 5 files changed, 36 insertions(+), 21 deletions(-) diff --git a/doc/cascadia/profiles.schema.json b/doc/cascadia/profiles.schema.json index aa5d18e44b3..900ec64969d 100644 --- a/doc/cascadia/profiles.schema.json +++ b/doc/cascadia/profiles.schema.json @@ -113,7 +113,9 @@ "left", "right", "up", - "down" + "down", + "next", + "previous" ], "type": "string" }, @@ -285,7 +287,7 @@ "direction": { "$ref": "#/definitions/Direction", "default": "left", - "description": "The direction to move focus in, between panes" + "description": "The direction to move focus in, between panes. Direction can be 'previous' to move to the most recently used pane or 'next' to move to the least recently used pane." } } } @@ -302,7 +304,7 @@ "direction": { "$ref": "#/definitions/Direction", "default": "left", - "description": "The direction to move the pane separator in" + "description": "The direction to move the pane separator in. Direction cannot be 'next' or 'previous'." } } } diff --git a/src/cascadia/TerminalApp/Pane.cpp b/src/cascadia/TerminalApp/Pane.cpp index 1be663ed3f7..4b793e90fc6 100644 --- a/src/cascadia/TerminalApp/Pane.cpp +++ b/src/cascadia/TerminalApp/Pane.cpp @@ -1566,17 +1566,30 @@ void Pane::Restore(std::shared_ptr zoomedPane) } } -uint16_t Pane::GetPaneId() noexcept +// Method Description: +// - Retrieves the ID of this pane +// Return Value: +// - The ID of this pane +uint16_t Pane::PaneId() noexcept { return _paneId; } -void Pane::SetPaneId(uint16_t id) noexcept +// Method Description: +// - Sets this pane's ID +// - Panes are given IDs upon creation by TerminalTab +// Arguments: +// - The number to set this pane's ID to +void Pane::PaneId(uint16_t id) noexcept { _paneId = id; } -void Pane::FocusPaneWithId(const uint16_t id) +// Method Description: +// - Recursive function that focuses a pane with the given ID +// Arguments: +// - The ID of the pane we want to focus +void Pane::FocusPane(const uint16_t id) { if (_IsLeaf() && id == _paneId) { @@ -1586,8 +1599,8 @@ void Pane::FocusPaneWithId(const uint16_t id) { if (_firstChild && _secondChild) { - _firstChild->FocusPaneWithId(id); - _secondChild->FocusPaneWithId(id); + _firstChild->FocusPane(id); + _secondChild->FocusPane(id); } } } diff --git a/src/cascadia/TerminalApp/Pane.h b/src/cascadia/TerminalApp/Pane.h index 4eb6ae1277f..9d41ee6c2dc 100644 --- a/src/cascadia/TerminalApp/Pane.h +++ b/src/cascadia/TerminalApp/Pane.h @@ -75,9 +75,9 @@ class Pane : public std::enable_shared_from_this void Maximize(std::shared_ptr zoomedPane); void Restore(std::shared_ptr zoomedPane); - uint16_t GetPaneId() noexcept; - void SetPaneId(uint16_t id) noexcept; - void FocusPaneWithId(const uint16_t id); + uint16_t PaneId() noexcept; + void PaneId(uint16_t id) noexcept; + void FocusPane(const uint16_t id); WINRT_CALLBACK(Closed, winrt::Windows::Foundation::EventHandler); DECLARE_EVENT(GotFocus, _GotFocusHandlers, winrt::delegate>); diff --git a/src/cascadia/TerminalApp/TerminalTab.cpp b/src/cascadia/TerminalApp/TerminalTab.cpp index 74c11107042..6a44067b6e2 100644 --- a/src/cascadia/TerminalApp/TerminalTab.cpp +++ b/src/cascadia/TerminalApp/TerminalTab.cpp @@ -29,7 +29,7 @@ namespace winrt::TerminalApp::implementation { _rootPane = std::make_shared(profile, control, true); - _rootPane->SetPaneId(_nextPaneId); + _rootPane->PaneId(_nextPaneId); _mruPanes.InsertAt(0, _nextPaneId); ++_nextPaneId; @@ -279,10 +279,10 @@ namespace winrt::TerminalApp::implementation // - void TerminalTab::SplitPane(SplitState splitType, const GUID& profile, TermControl& control) { - const auto activePaneId = _activePane->GetPaneId(); + const auto activePaneId = _activePane->PaneId(); auto [first, second] = _activePane->Split(splitType, profile, control); - first->SetPaneId(activePaneId); - second->SetPaneId(_nextPaneId); + first->PaneId(activePaneId); + second->PaneId(_nextPaneId); ++_nextPaneId; _activePane = first; _AttachEventHandlersToControl(control); @@ -346,11 +346,11 @@ namespace winrt::TerminalApp::implementation if (direction == Direction::Previous) { // To get to the previous pane, get the id of the previous pane and focus to that - _rootPane->FocusPaneWithId(_mruPanes.GetAt(1)); + _rootPane->FocusPane(_mruPanes.GetAt(1)); } else if (direction == Direction::Next) { - _rootPane->FocusPaneWithId(_mruPanes.GetAt(_mruPanes.Size() - 1)); + _rootPane->FocusPane(_mruPanes.GetAt(_mruPanes.Size() - 1)); } else { @@ -474,7 +474,7 @@ namespace winrt::TerminalApp::implementation // We need to move the pane to the top of our mru list // If its already somewhere in the list, remove it first uint32_t mruPaneIndex; - const auto paneId = pane->GetPaneId(); + const auto paneId = pane->PaneId(); if (_mruPanes.IndexOf(paneId, mruPaneIndex)) { _mruPanes.RemoveAt(mruPaneIndex); @@ -526,7 +526,7 @@ namespace winrt::TerminalApp::implementation if (auto pane = weakPane.lock()) { uint32_t mruIndex; - if (tab->_mruPanes.IndexOf(pane->GetPaneId(), mruIndex)) + if (tab->_mruPanes.IndexOf(pane->PaneId(), mruIndex)) { tab->_mruPanes.RemoveAt(mruIndex); } diff --git a/src/cascadia/TerminalSettingsModel/defaults.json b/src/cascadia/TerminalSettingsModel/defaults.json index 09d0f3df0eb..7b00d317712 100644 --- a/src/cascadia/TerminalSettingsModel/defaults.json +++ b/src/cascadia/TerminalSettingsModel/defaults.json @@ -331,8 +331,8 @@ { "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": { "action": "moveFocus", "direction": "previous" }, "keys": "ctrl+shift+left" }, - { "command": { "action": "moveFocus", "direction": "next" }, "keys": "ctrl+shift+right" }, + { "command": { "action": "moveFocus", "direction": "previous" }, "keys": "ctrl+alt+left" }, + { "command": { "action": "moveFocus", "direction": "next" }, "keys": "ctrl+alt+right" }, { "command": "togglePaneZoom" }, // Clipboard Integration From d9a6911ef7dbd9e6f10cea92f1e646ffd9323da0 Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Mon, 9 Nov 2020 14:34:42 -0500 Subject: [PATCH 05/21] new direction enum --- .../TerminalApp/AppActionHandlers.cpp | 8 +-- src/cascadia/TerminalApp/Pane.cpp | 12 ++--- src/cascadia/TerminalApp/Pane.h | 49 ++++++++++++++----- src/cascadia/TerminalApp/TerminalPage.cpp | 4 +- src/cascadia/TerminalApp/TerminalPage.h | 4 +- src/cascadia/TerminalApp/TerminalTab.cpp | 8 +-- src/cascadia/TerminalApp/TerminalTab.h | 4 +- .../TerminalSettingsModel/ActionArgs.cpp | 20 ++++---- .../TerminalSettingsModel/ActionArgs.h | 24 ++++----- .../TerminalSettingsModel/ActionArgs.idl | 17 +++++-- .../TerminalSettingsSerializationHelpers.h | 15 +++++- 11 files changed, 106 insertions(+), 59 deletions(-) diff --git a/src/cascadia/TerminalApp/AppActionHandlers.cpp b/src/cascadia/TerminalApp/AppActionHandlers.cpp index 5ac7c419340..47761be2efa 100644 --- a/src/cascadia/TerminalApp/AppActionHandlers.cpp +++ b/src/cascadia/TerminalApp/AppActionHandlers.cpp @@ -214,14 +214,14 @@ namespace winrt::TerminalApp::implementation { if (const auto& realArgs = args.ActionArgs().try_as()) { - if (realArgs.Direction() == Direction::None) + if (realArgs.ResizeDirection() == ResizeDirection::None) { // Do nothing args.Handled(false); } else { - _ResizePane(realArgs.Direction()); + _ResizePane(realArgs.ResizeDirection()); args.Handled(true); } } @@ -232,14 +232,14 @@ namespace winrt::TerminalApp::implementation { if (const auto& realArgs = args.ActionArgs().try_as()) { - if (realArgs.Direction() == Direction::None) + if (realArgs.FocusDirection() == FocusDirection::None) { // Do nothing args.Handled(false); } else { - _MoveFocus(realArgs.Direction()); + _MoveFocus(realArgs.FocusDirection()); args.Handled(true); } } diff --git a/src/cascadia/TerminalApp/Pane.cpp b/src/cascadia/TerminalApp/Pane.cpp index 4b793e90fc6..076c1ca4d42 100644 --- a/src/cascadia/TerminalApp/Pane.cpp +++ b/src/cascadia/TerminalApp/Pane.cpp @@ -130,7 +130,7 @@ void Pane::Relayout() // decreasing the size of our first child. // Return Value: // - false if we couldn't resize this pane in the given direction, else true. -bool Pane::_Resize(const Direction& direction) +bool Pane::_Resize(const ResizeDirection& direction) { if (!DirectionMatchesSplit(direction, _splitState)) { @@ -138,7 +138,7 @@ bool Pane::_Resize(const Direction& direction) } float amount = .05f; - if (direction == Direction::Right || direction == Direction::Down) + if (direction == ResizeDirection::Right || direction == ResizeDirection::Down) { amount = -amount; } @@ -171,7 +171,7 @@ bool Pane::_Resize(const Direction& direction) // - direction: The direction to move the separator in. // Return Value: // - true if we or a child handled this resize request. -bool Pane::ResizePane(const Direction& direction) +bool Pane::ResizePane(const ResizeDirection& direction) { // If we're a leaf, do nothing. We can't possibly have a descendant with a // separator the correct direction. @@ -223,14 +223,14 @@ bool Pane::ResizePane(const Direction& direction) // - direction: The direction to move the focus in. // Return Value: // - true if we handled this focus move request. -bool Pane::_NavigateFocus(const Direction& direction) +bool Pane::_NavigateFocus(const FocusDirection& direction) { if (!DirectionMatchesSplit(direction, _splitState)) { return false; } - const bool focusSecond = (direction == Direction::Right) || (direction == Direction::Down); + const bool focusSecond = (direction == FocusDirection::Right) || (direction == FocusDirection::Down); const auto newlyFocusedChild = focusSecond ? _secondChild : _firstChild; @@ -261,7 +261,7 @@ bool Pane::_NavigateFocus(const Direction& direction) // - direction: The direction to move the focus in. // Return Value: // - true if we or a child handled this focus move request. -bool Pane::NavigateFocus(const Direction& direction) +bool Pane::NavigateFocus(const FocusDirection& direction) { // If we're a leaf, do nothing. We can't possibly have a descendant with a // separator the correct direction. diff --git a/src/cascadia/TerminalApp/Pane.h b/src/cascadia/TerminalApp/Pane.h index 9d41ee6c2dc..c6138243e9c 100644 --- a/src/cascadia/TerminalApp/Pane.h +++ b/src/cascadia/TerminalApp/Pane.h @@ -55,8 +55,8 @@ class Pane : public std::enable_shared_from_this const GUID& profile); void ResizeContent(const winrt::Windows::Foundation::Size& newSize); void Relayout(); - bool ResizePane(const winrt::Microsoft::Terminal::Settings::Model::Direction& direction); - bool NavigateFocus(const winrt::Microsoft::Terminal::Settings::Model::Direction& direction); + bool ResizePane(const winrt::Microsoft::Terminal::Settings::Model::ResizeDirection& direction); + bool NavigateFocus(const winrt::Microsoft::Terminal::Settings::Model::FocusDirection& direction); bool CanSplit(winrt::Microsoft::Terminal::Settings::Model::SplitState splitType); std::pair, std::shared_ptr> Split(winrt::Microsoft::Terminal::Settings::Model::SplitState splitType, @@ -130,8 +130,8 @@ class Pane : public std::enable_shared_from_this void _SetupEntranceAnimation(); void _UpdateBorders(); - bool _Resize(const winrt::Microsoft::Terminal::Settings::Model::Direction& direction); - bool _NavigateFocus(const winrt::Microsoft::Terminal::Settings::Model::Direction& direction); + bool _Resize(const winrt::Microsoft::Terminal::Settings::Model::ResizeDirection& direction); + bool _NavigateFocus(const winrt::Microsoft::Terminal::Settings::Model::FocusDirection& direction); void _CloseChild(const bool closeFirst); winrt::fire_and_forget _CloseChildRoutine(const bool closeFirst); @@ -162,15 +162,13 @@ class Pane : public std::enable_shared_from_this // - This is used for pane resizing (which will need a pane separator // that's perpendicular to the direction to be able to move the separator // in that direction). - // - Additionally, it will be used for moving focus between panes, which - // again happens _across_ a separator. // Arguments: // - direction: The Direction to compare // - splitType: The winrt::TerminalApp::SplitState to compare // Return Value: // - true iff the direction is perpendicular to the splitType. False for // winrt::TerminalApp::SplitState::None. - static constexpr bool DirectionMatchesSplit(const winrt::Microsoft::Terminal::Settings::Model::Direction& direction, + static constexpr bool DirectionMatchesSplit(const winrt::Microsoft::Terminal::Settings::Model::ResizeDirection& direction, const winrt::Microsoft::Terminal::Settings::Model::SplitState& splitType) { if (splitType == winrt::Microsoft::Terminal::Settings::Model::SplitState::None) @@ -179,13 +177,42 @@ class Pane : public std::enable_shared_from_this } else if (splitType == winrt::Microsoft::Terminal::Settings::Model::SplitState::Horizontal) { - return direction == winrt::Microsoft::Terminal::Settings::Model::Direction::Up || - direction == winrt::Microsoft::Terminal::Settings::Model::Direction::Down; + return direction == winrt::Microsoft::Terminal::Settings::Model::ResizeDirection::Up || + direction == winrt::Microsoft::Terminal::Settings::Model::ResizeDirection::Down; } else if (splitType == winrt::Microsoft::Terminal::Settings::Model::SplitState::Vertical) { - return direction == winrt::Microsoft::Terminal::Settings::Model::Direction::Left || - direction == winrt::Microsoft::Terminal::Settings::Model::Direction::Right; + return direction == winrt::Microsoft::Terminal::Settings::Model::ResizeDirection::Left || + direction == winrt::Microsoft::Terminal::Settings::Model::ResizeDirection::Right; + } + return false; + } + + // Method Description + // - Exactly the same as the above DirectionMatchesSplit, but for FocusDirection instead of Resize + // - Uused for moving focus between panes, which again happens _across_ a separator. + // Arguments: + // - direction: The Direction to compare + // - splitType: The winrt::TerminalApp::SplitState to compare + // Return Value: + // - true iff the direction is perpendicular to the splitType. False for + // winrt::TerminalApp::SplitState::None. + static constexpr bool DirectionMatchesSplit(const winrt::Microsoft::Terminal::Settings::Model::FocusDirection& direction, + const winrt::Microsoft::Terminal::Settings::Model::SplitState& splitType) + { + if (splitType == winrt::Microsoft::Terminal::Settings::Model::SplitState::None) + { + return false; + } + else if (splitType == winrt::Microsoft::Terminal::Settings::Model::SplitState::Horizontal) + { + return direction == winrt::Microsoft::Terminal::Settings::Model::FocusDirection::Up || + direction == winrt::Microsoft::Terminal::Settings::Model::FocusDirection::Down; + } + else if (splitType == winrt::Microsoft::Terminal::Settings::Model::SplitState::Vertical) + { + return direction == winrt::Microsoft::Terminal::Settings::Model::FocusDirection::Left || + direction == winrt::Microsoft::Terminal::Settings::Model::FocusDirection::Right; } return false; } diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp index 4dcb3c04883..be078da6e93 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -1359,7 +1359,7 @@ namespace winrt::TerminalApp::implementation // - direction: The direction to move the focus in. // Return Value: // - - void TerminalPage::_MoveFocus(const Direction& direction) + void TerminalPage::_MoveFocus(const FocusDirection& direction) { if (auto index{ _GetFocusedTabIndex() }) { @@ -1633,7 +1633,7 @@ namespace winrt::TerminalApp::implementation // - direction: The direction to move the separator in. // Return Value: // - - void TerminalPage::_ResizePane(const Direction& direction) + void TerminalPage::_ResizePane(const ResizeDirection& direction) { if (auto index{ _GetFocusedTabIndex() }) { diff --git a/src/cascadia/TerminalApp/TerminalPage.h b/src/cascadia/TerminalApp/TerminalPage.h index 0672a5b218a..748c71c4d50 100644 --- a/src/cascadia/TerminalApp/TerminalPage.h +++ b/src/cascadia/TerminalApp/TerminalPage.h @@ -170,7 +170,7 @@ namespace winrt::TerminalApp::implementation void _SelectNextTab(const bool bMoveRight); bool _SelectTab(const uint32_t tabIndex); - void _MoveFocus(const Microsoft::Terminal::Settings::Model::Direction& direction); + void _MoveFocus(const Microsoft::Terminal::Settings::Model::FocusDirection& direction); winrt::Microsoft::Terminal::TerminalControl::TermControl _GetActiveControl(); std::optional _GetFocusedTabIndex() const noexcept; @@ -186,7 +186,7 @@ namespace winrt::TerminalApp::implementation // MSFT:20641986: Add keybindings for New Window void _Scroll(ScrollDirection scrollDirection, const Windows::Foundation::IReference& rowsToScroll); void _SplitPane(const Microsoft::Terminal::Settings::Model::SplitState splitType, const Microsoft::Terminal::Settings::Model::SplitType splitMode = Microsoft::Terminal::Settings::Model::SplitType::Manual, const Microsoft::Terminal::Settings::Model::NewTerminalArgs& newTerminalArgs = nullptr); - void _ResizePane(const Microsoft::Terminal::Settings::Model::Direction& direction); + void _ResizePane(const Microsoft::Terminal::Settings::Model::ResizeDirection& direction); void _ScrollPage(ScrollDirection scrollDirection); void _SetAcceleratorForMenuItem(Windows::UI::Xaml::Controls::MenuFlyoutItem& menuItem, const winrt::Microsoft::Terminal::TerminalControl::KeyChord& keyChord); diff --git a/src/cascadia/TerminalApp/TerminalTab.cpp b/src/cascadia/TerminalApp/TerminalTab.cpp index 6a44067b6e2..de8898e6ce0 100644 --- a/src/cascadia/TerminalApp/TerminalTab.cpp +++ b/src/cascadia/TerminalApp/TerminalTab.cpp @@ -327,7 +327,7 @@ namespace winrt::TerminalApp::implementation // - direction: The direction to move the separator in. // Return Value: // - - void TerminalTab::ResizePane(const Direction& direction) + void TerminalTab::ResizePane(const ResizeDirection& direction) { // NOTE: This _must_ be called on the root pane, so that it can propagate // throughout the entire tree. @@ -341,14 +341,14 @@ namespace winrt::TerminalApp::implementation // - direction: The direction to move the focus in. // Return Value: // - - void TerminalTab::NavigateFocus(const Direction& direction) + void TerminalTab::NavigateFocus(const FocusDirection& direction) { - if (direction == Direction::Previous) + if (direction == FocusDirection::Previous) { // To get to the previous pane, get the id of the previous pane and focus to that _rootPane->FocusPane(_mruPanes.GetAt(1)); } - else if (direction == Direction::Next) + else if (direction == FocusDirection::Next) { _rootPane->FocusPane(_mruPanes.GetAt(_mruPanes.Size() - 1)); } diff --git a/src/cascadia/TerminalApp/TerminalTab.h b/src/cascadia/TerminalApp/TerminalTab.h index a8f328f2e8a..1d2c543de2a 100644 --- a/src/cascadia/TerminalApp/TerminalTab.h +++ b/src/cascadia/TerminalApp/TerminalTab.h @@ -40,8 +40,8 @@ namespace winrt::TerminalApp::implementation bool PreCalculateCanSplit(winrt::Microsoft::Terminal::Settings::Model::SplitState splitType, winrt::Windows::Foundation::Size availableSpace) const; void ResizeContent(const winrt::Windows::Foundation::Size& newSize); - void ResizePane(const winrt::Microsoft::Terminal::Settings::Model::Direction& direction); - void NavigateFocus(const winrt::Microsoft::Terminal::Settings::Model::Direction& direction); + void ResizePane(const winrt::Microsoft::Terminal::Settings::Model::ResizeDirection& direction); + void NavigateFocus(const winrt::Microsoft::Terminal::Settings::Model::FocusDirection& direction); void UpdateSettings(const winrt::TerminalApp::TerminalSettings& settings, const GUID& profile); winrt::fire_and_forget UpdateTitle(); diff --git a/src/cascadia/TerminalSettingsModel/ActionArgs.cpp b/src/cascadia/TerminalSettingsModel/ActionArgs.cpp index 94d85549cc0..41237f5824d 100644 --- a/src/cascadia/TerminalSettingsModel/ActionArgs.cpp +++ b/src/cascadia/TerminalSettingsModel/ActionArgs.cpp @@ -145,18 +145,18 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation winrt::hstring ResizePaneArgs::GenerateName() const { winrt::hstring directionString; - switch (_Direction) + switch (_ResizeDirection) { - case Direction::Left: + case ResizeDirection::Left: directionString = RS_(L"DirectionLeft"); break; - case Direction::Right: + case ResizeDirection::Right: directionString = RS_(L"DirectionRight"); break; - case Direction::Up: + case ResizeDirection::Up: directionString = RS_(L"DirectionUp"); break; - case Direction::Down: + case ResizeDirection::Down: directionString = RS_(L"DirectionDown"); break; } @@ -169,18 +169,18 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation winrt::hstring MoveFocusArgs::GenerateName() const { winrt::hstring directionString; - switch (_Direction) + switch (_FocusDirection) { - case Direction::Left: + case FocusDirection::Left: directionString = RS_(L"DirectionLeft"); break; - case Direction::Right: + case FocusDirection::Right: directionString = RS_(L"DirectionRight"); break; - case Direction::Up: + case FocusDirection::Up: directionString = RS_(L"DirectionUp"); break; - case Direction::Down: + case FocusDirection::Down: directionString = RS_(L"DirectionDown"); break; } diff --git a/src/cascadia/TerminalSettingsModel/ActionArgs.h b/src/cascadia/TerminalSettingsModel/ActionArgs.h index 7d23d9e9391..0b8aea3c46c 100644 --- a/src/cascadia/TerminalSettingsModel/ActionArgs.h +++ b/src/cascadia/TerminalSettingsModel/ActionArgs.h @@ -221,7 +221,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation struct ResizePaneArgs : public ResizePaneArgsT { ResizePaneArgs() = default; - GETSET_PROPERTY(Model::Direction, Direction, Direction::None); + GETSET_PROPERTY(Model::ResizeDirection, ResizeDirection, ResizeDirection::None); static constexpr std::string_view DirectionKey{ "direction" }; @@ -233,7 +233,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation auto otherAsUs = other.try_as(); if (otherAsUs) { - return otherAsUs->_Direction == _Direction; + return otherAsUs->_ResizeDirection == _ResizeDirection; } return false; }; @@ -241,8 +241,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation { // LOAD BEARING: Not using make_self here _will_ break you in the future! auto args = winrt::make_self(); - JsonUtils::GetValueForKey(json, DirectionKey, args->_Direction); - if (args->_Direction == Direction::None) + JsonUtils::GetValueForKey(json, DirectionKey, args->_ResizeDirection); + if (args->_ResizeDirection == ResizeDirection::None) { return { nullptr, { SettingsLoadWarnings::MissingRequiredParameter } }; } @@ -254,7 +254,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation IActionArgs Copy() const { auto copy{ winrt::make_self() }; - copy->_Direction = _Direction; + copy->_ResizeDirection = _ResizeDirection; return *copy; } }; @@ -262,10 +262,10 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation struct MoveFocusArgs : public MoveFocusArgsT { MoveFocusArgs() = default; - MoveFocusArgs(Model::Direction direction) : - _Direction{ direction } {}; + MoveFocusArgs(Model::FocusDirection direction) : + _FocusDirection{ direction } {}; - GETSET_PROPERTY(Model::Direction, Direction, Direction::None); + GETSET_PROPERTY(Model::FocusDirection, FocusDirection, FocusDirection::None); static constexpr std::string_view DirectionKey{ "direction" }; @@ -277,7 +277,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation auto otherAsUs = other.try_as(); if (otherAsUs) { - return otherAsUs->_Direction == _Direction; + return otherAsUs->_FocusDirection == _FocusDirection; } return false; }; @@ -285,8 +285,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation { // LOAD BEARING: Not using make_self here _will_ break you in the future! auto args = winrt::make_self(); - JsonUtils::GetValueForKey(json, DirectionKey, args->_Direction); - if (args->_Direction == Direction::None) + JsonUtils::GetValueForKey(json, DirectionKey, args->_FocusDirection); + if (args->_FocusDirection == FocusDirection::None) { return { nullptr, { SettingsLoadWarnings::MissingRequiredParameter } }; } @@ -298,7 +298,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation IActionArgs Copy() const { auto copy{ winrt::make_self() }; - copy->_Direction = _Direction; + copy->_FocusDirection = _FocusDirection; return *copy; } }; diff --git a/src/cascadia/TerminalSettingsModel/ActionArgs.idl b/src/cascadia/TerminalSettingsModel/ActionArgs.idl index c6a7e5e8b91..800ea496c4f 100644 --- a/src/cascadia/TerminalSettingsModel/ActionArgs.idl +++ b/src/cascadia/TerminalSettingsModel/ActionArgs.idl @@ -16,7 +16,16 @@ namespace Microsoft.Terminal.Settings.Model IActionArgs ActionArgs { get; }; }; - enum Direction + enum ResizeDirection + { + None = 0, + Left, + Right, + Up, + Down + }; + + enum FocusDirection { None = 0, Left, @@ -92,13 +101,13 @@ namespace Microsoft.Terminal.Settings.Model [default_interface] runtimeclass ResizePaneArgs : IActionArgs { - Direction Direction { get; }; + ResizeDirection ResizeDirection { get; }; }; [default_interface] runtimeclass MoveFocusArgs : IActionArgs { - MoveFocusArgs(Direction direction); - Direction Direction { get; }; + MoveFocusArgs(FocusDirection direction); + FocusDirection FocusDirection { get; }; }; [default_interface] runtimeclass AdjustFontSizeArgs : IActionArgs diff --git a/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h b/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h index 135d4466246..4515e2e58d1 100644 --- a/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h +++ b/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h @@ -330,8 +330,8 @@ struct ::Microsoft::Terminal::Settings::Model::JsonUtils::ConversionTrait<::winr } }; -// Possible Direction values -JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::Direction) +// Possible FocusDirection values +JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::FocusDirection) { JSON_MAPPINGS(6) = { pair_type{ "left", ValueType::Left }, @@ -343,6 +343,17 @@ JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::Direction) }; }; +// Possible ResizeDirection values +JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::ResizeDirection) +{ + JSON_MAPPINGS(6) = { + pair_type{ "left", ValueType::Left }, + pair_type{ "right", ValueType::Right }, + pair_type{ "up", ValueType::Up }, + pair_type{ "down", ValueType::Down } + }; +}; + // Possible SplitState values JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::SplitState) { From 3bad680b0edaa8604767835ae782b999b9f23c7c Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Tue, 24 Nov 2020 16:28:50 -0800 Subject: [PATCH 06/21] conflict --- doc/cascadia/profiles.schema.json | 148 ++++++++++++++++++++---------- 1 file changed, 100 insertions(+), 48 deletions(-) diff --git a/doc/cascadia/profiles.schema.json b/doc/cascadia/profiles.schema.json index 900ec64969d..9740a7c6d2f 100644 --- a/doc/cascadia/profiles.schema.json +++ b/doc/cascadia/profiles.schema.json @@ -108,7 +108,7 @@ ], "type": "string" }, - "Direction": { + "FocusDirection": { "enum": [ "left", "right", @@ -119,6 +119,15 @@ ], "type": "string" }, + "ResizeDirection": { + "enum": [ + "left", + "right", + "up", + "down" + ], + "type": "string" + }, "SplitState": { "enum": [ "vertical", @@ -209,7 +218,10 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { "type": "string", "pattern": "adjustFontSize" }, + "action": { + "type": "string", + "pattern": "adjustFontSize" + }, "delta": { "type": "integer", "default": 0, @@ -226,7 +238,10 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { "type": "string", "pattern": "copy" }, + "action": { + "type": "string", + "pattern": "copy" + }, "singleLine": { "type": "boolean", "default": false, @@ -255,7 +270,10 @@ { "$ref": "#/definitions/NewTerminalArgs" }, { "properties": { - "action": { "type":"string", "pattern": "newTab" } + "action": { + "type": "string", + "pattern": "newTab" + } } } ] @@ -266,7 +284,10 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { "type": "string", "pattern": "switchToTab" }, + "action": { + "type": "string", + "pattern": "switchToTab" + }, "index": { "type": "integer", "default": 0, @@ -283,9 +304,12 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { "type": "string", "pattern": "moveFocus" }, + "action": { + "type": "string", + "pattern": "moveFocus" + }, "direction": { - "$ref": "#/definitions/Direction", + "$ref": "#/definitions/FocusDirection", "default": "left", "description": "The direction to move focus in, between panes. Direction can be 'previous' to move to the most recently used pane or 'next' to move to the least recently used pane." } @@ -300,11 +324,14 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { "type": "string", "pattern": "resizePane" }, + "action": { + "type": "string", + "pattern": "resizePane" + }, "direction": { - "$ref": "#/definitions/Direction", + "$ref": "#/definitions/ResizeDirection", "default": "left", - "description": "The direction to move the pane separator in. Direction cannot be 'next' or 'previous'." + "description": "The direction to move the pane separator in." } } } @@ -340,7 +367,10 @@ { "$ref": "#/definitions/NewTerminalArgs" }, { "properties": { - "action": { "type": "string", "pattern": "splitPane" }, + "action": { + "type": "string", + "pattern": "splitPane" + }, "split": { "$ref": "#/definitions/SplitState", "default": "auto", @@ -386,7 +416,10 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { "type": "string", "pattern": "setTabColor" }, + "action": { + "type": "string", + "pattern": "setTabColor" + }, "color": { "$ref": "#/definitions/Color", "default": null, @@ -402,7 +435,10 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { "type": "string", "pattern": "setColorScheme" }, + "action": { + "type": "string", + "pattern": "setColorScheme" + }, "colorScheme": { "type": "string", "default": "", @@ -419,7 +455,10 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { "type": "string", "pattern": "wt" }, + "action": { + "type": "string", + "pattern": "wt" + }, "commandline": { "type": "string", "default": "", @@ -436,7 +475,10 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { "type": "string", "pattern": "closeOtherTabs" }, + "action": { + "type": "string", + "pattern": "closeOtherTabs" + }, "index": { "oneOf": [ { "type": "integer" }, @@ -455,7 +497,10 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { "type": "string", "pattern": "closeTabsAfter" }, + "action": { + "type": "string", + "pattern": "closeTabsAfter" + }, "index": { "oneOf": [ { "type": "integer" }, @@ -474,9 +519,12 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { "type": "string", "pattern": "scrollUp" }, + "action": { + "type": "string", + "pattern": "scrollUp" + }, "rowsToScroll": { - "type": ["integer", "null"], + "type": [ "integer", "null" ], "default": null, "description": "Scroll up rowsToScroll lines. If no value is provided, use the system-level defaults." } @@ -490,9 +538,12 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { "type": "string", "pattern": "scrollDown" }, + "action": { + "type": "string", + "pattern": "scrollDown" + }, "rowsToScroll": { - "type": ["integer", "null"], + "type": [ "integer", "null" ], "default": null, "description": "Scroll down rowsToScroll lines. If no value is provided, use the system-level defaults." } @@ -505,26 +556,26 @@ "properties": { "command": { "description": "The action executed when the associated key bindings are pressed.", - "oneOf": [ - { "$ref": "#/definitions/AdjustFontSizeAction" }, - { "$ref": "#/definitions/CopyAction" }, - { "$ref": "#/definitions/ShortcutActionName" }, - { "$ref": "#/definitions/NewTabAction" }, - { "$ref": "#/definitions/SwitchToTabAction" }, - { "$ref": "#/definitions/MoveFocusAction" }, - { "$ref": "#/definitions/ResizePaneAction" }, - { "$ref": "#/definitions/SendInputAction" }, - { "$ref": "#/definitions/SplitPaneAction" }, - { "$ref": "#/definitions/OpenSettingsAction" }, - { "$ref": "#/definitions/SetTabColorAction" }, - { "$ref": "#/definitions/SetColorSchemeAction" }, - { "$ref": "#/definitions/WtAction" }, - { "$ref": "#/definitions/CloseOtherTabsAction" }, - { "$ref": "#/definitions/CloseTabsAfterAction" }, - { "$ref": "#/definitions/ScrollUpAction" }, - { "$ref": "#/definitions/ScrollDownAction" }, - { "type": "null" } - ] + "oneOf": [ + { "$ref": "#/definitions/AdjustFontSizeAction" }, + { "$ref": "#/definitions/CopyAction" }, + { "$ref": "#/definitions/ShortcutActionName" }, + { "$ref": "#/definitions/NewTabAction" }, + { "$ref": "#/definitions/SwitchToTabAction" }, + { "$ref": "#/definitions/MoveFocusAction" }, + { "$ref": "#/definitions/ResizePaneAction" }, + { "$ref": "#/definitions/SendInputAction" }, + { "$ref": "#/definitions/SplitPaneAction" }, + { "$ref": "#/definitions/OpenSettingsAction" }, + { "$ref": "#/definitions/SetTabColorAction" }, + { "$ref": "#/definitions/SetColorSchemeAction" }, + { "$ref": "#/definitions/WtAction" }, + { "$ref": "#/definitions/CloseOtherTabsAction" }, + { "$ref": "#/definitions/CloseTabsAfterAction" }, + { "$ref": "#/definitions/ScrollUpAction" }, + { "$ref": "#/definitions/ScrollDownAction" }, + { "type": "null" } + ] }, "keys": { "description": "Defines the key combinations used to call the command. It must be composed of...\n -any number of modifiers (ctrl/alt/shift)\n -a non-modifier key", @@ -775,7 +826,7 @@ "$ref": "#/definitions/Color", "default": "#0c0c0c", "description": "Sets the background color of the text. Overrides \"background\" from the color scheme. Uses hex color format: \"#rrggbb\".", - "type": ["string", "null"] + "type": [ "string", "null" ] }, "backgroundImage": { "description": "Sets the file location of the image to draw over the window background.", @@ -789,6 +840,7 @@ ] } ] + "type": [ "string", "null" ] }, "backgroundImageAlignment": { "default": "center", @@ -858,7 +910,7 @@ "cursorColor": { "oneOf": [ { "$ref": "#/definitions/Color" }, - {"type": "null"} + { "type": "null" } ], "description": "Sets the color of the cursor. Overrides the cursor color from the color scheme. Uses hex color format: \"#rrggbb\"." }, @@ -866,7 +918,7 @@ "description": "Sets the percentage height of the cursor starting from the bottom. Only works when cursorShape is set to \"vintage\". Accepts values from 25-100.", "maximum": 100, "minimum": 25, - "type": ["integer","null"], + "type": [ "integer", "null" ], "default": 25 }, "cursorShape": { @@ -927,7 +979,7 @@ "$ref": "#/definitions/Color", "default": "#cccccc", "description": "Sets the text color. Overrides \"foreground\" from the color scheme. Uses hex color format: \"#rrggbb\".", - "type": ["string", "null"] + "type": [ "string", "null" ] }, "guid": { "$ref": "#/definitions/ProfileGuid", @@ -944,7 +996,7 @@ "minimum": -1, "type": "integer" }, - "icon":{ "$ref": "#/definitions/Icon" }, + "icon": { "$ref": "#/definitions/Icon" }, "name": { "description": "Name of the profile. Displays in the dropdown menu.", "minLength": 1, @@ -974,7 +1026,7 @@ }, "selectionBackground": { "oneOf": [ - {"$ref": "#/definitions/Color"}, + { "$ref": "#/definitions/Color" }, { "type": "null" } ], "description": "Sets the background color of selected text. Overrides selectionBackground set in the color scheme. Uses hex color format: \"#rrggbb\"." @@ -991,7 +1043,7 @@ }, "source": { "description": "Stores the name of the profile generator that originated this profile.", - "type": ["string", "null"] + "type": [ "string", "null" ] }, "startingDirectory": { "description": "The directory the shell starts in when it is loaded.", @@ -1004,7 +1056,7 @@ }, "tabTitle": { "description": "If set, will replace the name as the title to pass to the shell on startup. Some shells (like bash) may choose to ignore this initial value, while others (cmd, powershell) may use this value over the lifetime of the application.", - "type": ["string", "null"] + "type": [ "string", "null" ] }, "useAcrylic": { "default": false, From 009fba36fbb519afb38885260c90b7c673e74713 Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Mon, 9 Nov 2020 14:47:26 -0500 Subject: [PATCH 07/21] undo formatting changes from VS rebase --- doc/cascadia/profiles.schema.json | 138 ++++++++++-------------------- 1 file changed, 45 insertions(+), 93 deletions(-) diff --git a/doc/cascadia/profiles.schema.json b/doc/cascadia/profiles.schema.json index 9740a7c6d2f..5701439ac9f 100644 --- a/doc/cascadia/profiles.schema.json +++ b/doc/cascadia/profiles.schema.json @@ -218,10 +218,7 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { - "type": "string", - "pattern": "adjustFontSize" - }, + "action": { "type": "string", "pattern": "adjustFontSize" }, "delta": { "type": "integer", "default": 0, @@ -238,10 +235,7 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { - "type": "string", - "pattern": "copy" - }, + "action": { "type": "string", "pattern": "copy" }, "singleLine": { "type": "boolean", "default": false, @@ -270,10 +264,7 @@ { "$ref": "#/definitions/NewTerminalArgs" }, { "properties": { - "action": { - "type": "string", - "pattern": "newTab" - } + "action": { "type": "string", "pattern": "newTab" } } } ] @@ -284,10 +275,7 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { - "type": "string", - "pattern": "switchToTab" - }, + "action": { "type": "string", "pattern": "switchToTab" }, "index": { "type": "integer", "default": 0, @@ -304,10 +292,7 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { - "type": "string", - "pattern": "moveFocus" - }, + "action": { "type": "string", "pattern": "moveFocus" }, "direction": { "$ref": "#/definitions/FocusDirection", "default": "left", @@ -324,10 +309,7 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { - "type": "string", - "pattern": "resizePane" - }, + "action": { "type": "string", "pattern": "resizePane" }, "direction": { "$ref": "#/definitions/ResizeDirection", "default": "left", @@ -346,10 +328,7 @@ }, { "properties": { - "action": { - "type": "string", - "pattern": "sendInput" - }, + "action": { "type": "string", "pattern": "sendInput" }, "input": { "type": "string", "default": "", @@ -367,10 +346,7 @@ { "$ref": "#/definitions/NewTerminalArgs" }, { "properties": { - "action": { - "type": "string", - "pattern": "splitPane" - }, + "action": { "type": "string", "pattern": "splitPane" }, "split": { "$ref": "#/definitions/SplitState", "default": "auto", @@ -392,10 +368,7 @@ }, { "properties": { - "action": { - "type": "string", - "pattern": "openSettings" - }, + "action": { "type": "string", "pattern": "openSettings" }, "target": { "type": "string", "default": "settingsFile", @@ -416,10 +389,7 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { - "type": "string", - "pattern": "setTabColor" - }, + "action": { "type": "string", "pattern": "setTabColor" }, "color": { "$ref": "#/definitions/Color", "default": null, @@ -435,10 +405,7 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { - "type": "string", - "pattern": "setColorScheme" - }, + "action": { "type": "string", "pattern": "setColorScheme" }, "colorScheme": { "type": "string", "default": "", @@ -455,10 +422,7 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { - "type": "string", - "pattern": "wt" - }, + "action": { "type": "string", "pattern": "wt" }, "commandline": { "type": "string", "default": "", @@ -475,10 +439,7 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { - "type": "string", - "pattern": "closeOtherTabs" - }, + "action": { "type": "string", "pattern": "closeOtherTabs" }, "index": { "oneOf": [ { "type": "integer" }, @@ -497,10 +458,7 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { - "type": "string", - "pattern": "closeTabsAfter" - }, + "action": { "type": "string", "pattern": "closeTabsAfter" }, "index": { "oneOf": [ { "type": "integer" }, @@ -519,10 +477,7 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { - "type": "string", - "pattern": "scrollUp" - }, + "action": { "type": "string", "pattern": "scrollUp" }, "rowsToScroll": { "type": [ "integer", "null" ], "default": null, @@ -538,10 +493,7 @@ { "$ref": "#/definitions/ShortcutAction" }, { "properties": { - "action": { - "type": "string", - "pattern": "scrollDown" - }, + "action": { "type": "string", "pattern": "scrollDown" }, "rowsToScroll": { "type": [ "integer", "null" ], "default": null, @@ -556,26 +508,26 @@ "properties": { "command": { "description": "The action executed when the associated key bindings are pressed.", - "oneOf": [ - { "$ref": "#/definitions/AdjustFontSizeAction" }, - { "$ref": "#/definitions/CopyAction" }, - { "$ref": "#/definitions/ShortcutActionName" }, - { "$ref": "#/definitions/NewTabAction" }, - { "$ref": "#/definitions/SwitchToTabAction" }, - { "$ref": "#/definitions/MoveFocusAction" }, - { "$ref": "#/definitions/ResizePaneAction" }, - { "$ref": "#/definitions/SendInputAction" }, - { "$ref": "#/definitions/SplitPaneAction" }, - { "$ref": "#/definitions/OpenSettingsAction" }, - { "$ref": "#/definitions/SetTabColorAction" }, - { "$ref": "#/definitions/SetColorSchemeAction" }, - { "$ref": "#/definitions/WtAction" }, - { "$ref": "#/definitions/CloseOtherTabsAction" }, - { "$ref": "#/definitions/CloseTabsAfterAction" }, - { "$ref": "#/definitions/ScrollUpAction" }, - { "$ref": "#/definitions/ScrollDownAction" }, - { "type": "null" } - ] + "oneOf": [ + { "$ref": "#/definitions/AdjustFontSizeAction" }, + { "$ref": "#/definitions/CopyAction" }, + { "$ref": "#/definitions/ShortcutActionName" }, + { "$ref": "#/definitions/NewTabAction" }, + { "$ref": "#/definitions/SwitchToTabAction" }, + { "$ref": "#/definitions/MoveFocusAction" }, + { "$ref": "#/definitions/ResizePaneAction" }, + { "$ref": "#/definitions/SendInputAction" }, + { "$ref": "#/definitions/SplitPaneAction" }, + { "$ref": "#/definitions/OpenSettingsAction" }, + { "$ref": "#/definitions/SetTabColorAction" }, + { "$ref": "#/definitions/SetColorSchemeAction" }, + { "$ref": "#/definitions/WtAction" }, + { "$ref": "#/definitions/CloseOtherTabsAction" }, + { "$ref": "#/definitions/CloseTabsAfterAction" }, + { "$ref": "#/definitions/ScrollUpAction" }, + { "$ref": "#/definitions/ScrollDownAction" }, + { "type": "null" } + ] }, "keys": { "description": "Defines the key combinations used to call the command. It must be composed of...\n -any number of modifiers (ctrl/alt/shift)\n -a non-modifier key", @@ -771,7 +723,7 @@ "enum": [ "mru", "inOrder", - "disabled" + "disabled", ], "type": "string" } @@ -789,7 +741,7 @@ "enum": [ "mru", "inOrder", - "disabled" + "disabled", ], "type": "string" } @@ -826,7 +778,7 @@ "$ref": "#/definitions/Color", "default": "#0c0c0c", "description": "Sets the background color of the text. Overrides \"background\" from the color scheme. Uses hex color format: \"#rrggbb\".", - "type": [ "string", "null" ] + "type": ["string", "null"] }, "backgroundImage": { "description": "Sets the file location of the image to draw over the window background.", @@ -918,7 +870,7 @@ "description": "Sets the percentage height of the cursor starting from the bottom. Only works when cursorShape is set to \"vintage\". Accepts values from 25-100.", "maximum": 100, "minimum": 25, - "type": [ "integer", "null" ], + "type": ["integer", "null"], "default": 25 }, "cursorShape": { @@ -979,7 +931,7 @@ "$ref": "#/definitions/Color", "default": "#cccccc", "description": "Sets the text color. Overrides \"foreground\" from the color scheme. Uses hex color format: \"#rrggbb\".", - "type": [ "string", "null" ] + "type": ["string", "null"] }, "guid": { "$ref": "#/definitions/ProfileGuid", @@ -996,7 +948,7 @@ "minimum": -1, "type": "integer" }, - "icon": { "$ref": "#/definitions/Icon" }, + "icon":{ "$ref": "#/definitions/Icon" }, "name": { "description": "Name of the profile. Displays in the dropdown menu.", "minLength": 1, @@ -1026,7 +978,7 @@ }, "selectionBackground": { "oneOf": [ - { "$ref": "#/definitions/Color" }, + {"$ref": "#/definitions/Color"}, { "type": "null" } ], "description": "Sets the background color of selected text. Overrides selectionBackground set in the color scheme. Uses hex color format: \"#rrggbb\"." @@ -1043,7 +995,7 @@ }, "source": { "description": "Stores the name of the profile generator that originated this profile.", - "type": [ "string", "null" ] + "type": ["string", "null"] }, "startingDirectory": { "description": "The directory the shell starts in when it is loaded.", @@ -1056,7 +1008,7 @@ }, "tabTitle": { "description": "If set, will replace the name as the title to pass to the shell on startup. Some shells (like bash) may choose to ignore this initial value, while others (cmd, powershell) may use this value over the lifetime of the application.", - "type": [ "string", "null" ] + "type": ["string", "null"] }, "useAcrylic": { "default": false, From 0638d74612f8792975a32142517632e8e1a0d0f3 Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Mon, 9 Nov 2020 14:52:25 -0500 Subject: [PATCH 08/21] more formatting --- doc/cascadia/profiles.schema.json | 50 +++++++++++++++---------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/doc/cascadia/profiles.schema.json b/doc/cascadia/profiles.schema.json index 5701439ac9f..c3c385a343b 100644 --- a/doc/cascadia/profiles.schema.json +++ b/doc/cascadia/profiles.schema.json @@ -264,7 +264,7 @@ { "$ref": "#/definitions/NewTerminalArgs" }, { "properties": { - "action": { "type": "string", "pattern": "newTab" } + "action": { "type":"string", "pattern": "newTab" } } } ] @@ -479,7 +479,7 @@ "properties": { "action": { "type": "string", "pattern": "scrollUp" }, "rowsToScroll": { - "type": [ "integer", "null" ], + "type": ["integer", "null"], "default": null, "description": "Scroll up rowsToScroll lines. If no value is provided, use the system-level defaults." } @@ -495,7 +495,7 @@ "properties": { "action": { "type": "string", "pattern": "scrollDown" }, "rowsToScroll": { - "type": [ "integer", "null" ], + "type": ["integer", "null"], "default": null, "description": "Scroll down rowsToScroll lines. If no value is provided, use the system-level defaults." } @@ -508,26 +508,26 @@ "properties": { "command": { "description": "The action executed when the associated key bindings are pressed.", - "oneOf": [ - { "$ref": "#/definitions/AdjustFontSizeAction" }, - { "$ref": "#/definitions/CopyAction" }, - { "$ref": "#/definitions/ShortcutActionName" }, - { "$ref": "#/definitions/NewTabAction" }, - { "$ref": "#/definitions/SwitchToTabAction" }, - { "$ref": "#/definitions/MoveFocusAction" }, - { "$ref": "#/definitions/ResizePaneAction" }, - { "$ref": "#/definitions/SendInputAction" }, - { "$ref": "#/definitions/SplitPaneAction" }, - { "$ref": "#/definitions/OpenSettingsAction" }, - { "$ref": "#/definitions/SetTabColorAction" }, - { "$ref": "#/definitions/SetColorSchemeAction" }, - { "$ref": "#/definitions/WtAction" }, - { "$ref": "#/definitions/CloseOtherTabsAction" }, - { "$ref": "#/definitions/CloseTabsAfterAction" }, - { "$ref": "#/definitions/ScrollUpAction" }, - { "$ref": "#/definitions/ScrollDownAction" }, - { "type": "null" } - ] + "oneOf": [ + { "$ref": "#/definitions/AdjustFontSizeAction" }, + { "$ref": "#/definitions/CopyAction" }, + { "$ref": "#/definitions/ShortcutActionName" }, + { "$ref": "#/definitions/NewTabAction" }, + { "$ref": "#/definitions/SwitchToTabAction" }, + { "$ref": "#/definitions/MoveFocusAction" }, + { "$ref": "#/definitions/ResizePaneAction" }, + { "$ref": "#/definitions/SendInputAction" }, + { "$ref": "#/definitions/SplitPaneAction" }, + { "$ref": "#/definitions/OpenSettingsAction" }, + { "$ref": "#/definitions/SetTabColorAction" }, + { "$ref": "#/definitions/SetColorSchemeAction" }, + { "$ref": "#/definitions/WtAction" }, + { "$ref": "#/definitions/CloseOtherTabsAction" }, + { "$ref": "#/definitions/CloseTabsAfterAction" }, + { "$ref": "#/definitions/ScrollUpAction" }, + { "$ref": "#/definitions/ScrollDownAction" }, + { "type": "null" } + ] }, "keys": { "description": "Defines the key combinations used to call the command. It must be composed of...\n -any number of modifiers (ctrl/alt/shift)\n -a non-modifier key", @@ -862,7 +862,7 @@ "cursorColor": { "oneOf": [ { "$ref": "#/definitions/Color" }, - { "type": "null" } + {"type": "null"} ], "description": "Sets the color of the cursor. Overrides the cursor color from the color scheme. Uses hex color format: \"#rrggbb\"." }, @@ -870,7 +870,7 @@ "description": "Sets the percentage height of the cursor starting from the bottom. Only works when cursorShape is set to \"vintage\". Accepts values from 25-100.", "maximum": 100, "minimum": 25, - "type": ["integer", "null"], + "type": ["integer","null"], "default": 25 }, "cursorShape": { From f9bea95e76fb6e56ad7b32d553772e4713290d9e Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Mon, 9 Nov 2020 14:56:51 -0500 Subject: [PATCH 09/21] spell --- src/cascadia/TerminalApp/Pane.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cascadia/TerminalApp/Pane.h b/src/cascadia/TerminalApp/Pane.h index c6138243e9c..9502f309377 100644 --- a/src/cascadia/TerminalApp/Pane.h +++ b/src/cascadia/TerminalApp/Pane.h @@ -190,7 +190,7 @@ class Pane : public std::enable_shared_from_this // Method Description // - Exactly the same as the above DirectionMatchesSplit, but for FocusDirection instead of Resize - // - Uused for moving focus between panes, which again happens _across_ a separator. + // - Used for moving focus between panes, which again happens _across_ a separator. // Arguments: // - direction: The Direction to compare // - splitType: The winrt::TerminalApp::SplitState to compare From 753f17fd798541655d95c0335e0d9fcaa00e84ff Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Mon, 9 Nov 2020 15:09:11 -0500 Subject: [PATCH 10/21] update test --- src/cascadia/LocalTests_TerminalApp/TabTests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cascadia/LocalTests_TerminalApp/TabTests.cpp b/src/cascadia/LocalTests_TerminalApp/TabTests.cpp index bb5003f1757..e9e4a4217ff 100644 --- a/src/cascadia/LocalTests_TerminalApp/TabTests.cpp +++ b/src/cascadia/LocalTests_TerminalApp/TabTests.cpp @@ -664,7 +664,7 @@ namespace TerminalAppLocalTests Log::Comment(L"Move focus. This will cause us to un-zoom."); result = RunOnUIThread([&page]() { // Set up action - MoveFocusArgs args{ Direction::Left }; + MoveFocusArgs args{ FocusDirection::Left }; ActionEventArgs eventArgs{ args }; page->_HandleMoveFocus(nullptr, eventArgs); From b12e9fb38ebcd1e7d32af754042d02ece31f6576 Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Tue, 24 Nov 2020 16:53:41 -0800 Subject: [PATCH 11/21] Remove 'next' as a possible focus direction --- doc/cascadia/profiles.schema.json | 1 - src/cascadia/TerminalApp/TerminalTab.cpp | 4 ---- src/cascadia/TerminalSettingsModel/ActionArgs.idl | 3 +-- .../TerminalSettingsSerializationHelpers.h | 3 +-- src/cascadia/TerminalSettingsModel/defaults.json | 1 - 5 files changed, 2 insertions(+), 10 deletions(-) diff --git a/doc/cascadia/profiles.schema.json b/doc/cascadia/profiles.schema.json index c3c385a343b..8638f5562c1 100644 --- a/doc/cascadia/profiles.schema.json +++ b/doc/cascadia/profiles.schema.json @@ -114,7 +114,6 @@ "right", "up", "down", - "next", "previous" ], "type": "string" diff --git a/src/cascadia/TerminalApp/TerminalTab.cpp b/src/cascadia/TerminalApp/TerminalTab.cpp index de8898e6ce0..b72c98e54d5 100644 --- a/src/cascadia/TerminalApp/TerminalTab.cpp +++ b/src/cascadia/TerminalApp/TerminalTab.cpp @@ -348,10 +348,6 @@ namespace winrt::TerminalApp::implementation // To get to the previous pane, get the id of the previous pane and focus to that _rootPane->FocusPane(_mruPanes.GetAt(1)); } - else if (direction == FocusDirection::Next) - { - _rootPane->FocusPane(_mruPanes.GetAt(_mruPanes.Size() - 1)); - } else { // NOTE: This _must_ be called on the root pane, so that it can propagate diff --git a/src/cascadia/TerminalSettingsModel/ActionArgs.idl b/src/cascadia/TerminalSettingsModel/ActionArgs.idl index 800ea496c4f..a606fd077dc 100644 --- a/src/cascadia/TerminalSettingsModel/ActionArgs.idl +++ b/src/cascadia/TerminalSettingsModel/ActionArgs.idl @@ -32,8 +32,7 @@ namespace Microsoft.Terminal.Settings.Model Right, Up, Down, - Previous, - Next + Previous }; enum SplitState diff --git a/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h b/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h index 4515e2e58d1..bf2ad30872e 100644 --- a/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h +++ b/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h @@ -333,13 +333,12 @@ struct ::Microsoft::Terminal::Settings::Model::JsonUtils::ConversionTrait<::winr // Possible FocusDirection values JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::FocusDirection) { - JSON_MAPPINGS(6) = { + JSON_MAPPINGS(5) = { pair_type{ "left", ValueType::Left }, pair_type{ "right", ValueType::Right }, pair_type{ "up", ValueType::Up }, pair_type{ "down", ValueType::Down }, pair_type{ "previous", ValueType::Previous }, - pair_type{ "next", ValueType::Next }, }; }; diff --git a/src/cascadia/TerminalSettingsModel/defaults.json b/src/cascadia/TerminalSettingsModel/defaults.json index 7b00d317712..1f4eee82fd3 100644 --- a/src/cascadia/TerminalSettingsModel/defaults.json +++ b/src/cascadia/TerminalSettingsModel/defaults.json @@ -332,7 +332,6 @@ { "command": { "action": "moveFocus", "direction": "right" }, "keys": "alt+right" }, { "command": { "action": "moveFocus", "direction": "up" }, "keys": "alt+up" }, { "command": { "action": "moveFocus", "direction": "previous" }, "keys": "ctrl+alt+left" }, - { "command": { "action": "moveFocus", "direction": "next" }, "keys": "ctrl+alt+right" }, { "command": "togglePaneZoom" }, // Clipboard Integration From 24f25addcfeaa263a57ac35f1dcdfbe308bb4ff3 Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Tue, 24 Nov 2020 16:56:56 -0800 Subject: [PATCH 12/21] update schema --- doc/cascadia/profiles.schema.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/cascadia/profiles.schema.json b/doc/cascadia/profiles.schema.json index 8638f5562c1..b779a366bf7 100644 --- a/doc/cascadia/profiles.schema.json +++ b/doc/cascadia/profiles.schema.json @@ -295,7 +295,7 @@ "direction": { "$ref": "#/definitions/FocusDirection", "default": "left", - "description": "The direction to move focus in, between panes. Direction can be 'previous' to move to the most recently used pane or 'next' to move to the least recently used pane." + "description": "The direction to move focus in, between panes. Direction can be 'previous' to move to the most recently used pane." } } } @@ -722,7 +722,7 @@ "enum": [ "mru", "inOrder", - "disabled", + "disabled" ], "type": "string" } @@ -740,7 +740,7 @@ "enum": [ "mru", "inOrder", - "disabled", + "disabled" ], "type": "string" } From d2eb1d6c9fd07e3493a797a1643ae471c719a0ba Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Mon, 30 Nov 2020 15:42:32 -0800 Subject: [PATCH 13/21] rename paneId to Id --- doc/cascadia/profiles.schema.json | 2 +- src/cascadia/TerminalApp/Pane.cpp | 10 +++++----- src/cascadia/TerminalApp/Pane.h | 6 +++--- src/cascadia/TerminalApp/TerminalTab.cpp | 12 ++++++------ 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/doc/cascadia/profiles.schema.json b/doc/cascadia/profiles.schema.json index b779a366bf7..f81e721bb2f 100644 --- a/doc/cascadia/profiles.schema.json +++ b/doc/cascadia/profiles.schema.json @@ -790,7 +790,7 @@ "desktopWallpaper" ] } - ] + ], "type": [ "string", "null" ] }, "backgroundImageAlignment": { diff --git a/src/cascadia/TerminalApp/Pane.cpp b/src/cascadia/TerminalApp/Pane.cpp index 076c1ca4d42..afc00b667f6 100644 --- a/src/cascadia/TerminalApp/Pane.cpp +++ b/src/cascadia/TerminalApp/Pane.cpp @@ -1570,9 +1570,9 @@ void Pane::Restore(std::shared_ptr zoomedPane) // - Retrieves the ID of this pane // Return Value: // - The ID of this pane -uint16_t Pane::PaneId() noexcept +uint16_t Pane::Id() noexcept { - return _paneId; + return _id; } // Method Description: @@ -1580,9 +1580,9 @@ uint16_t Pane::PaneId() noexcept // - Panes are given IDs upon creation by TerminalTab // Arguments: // - The number to set this pane's ID to -void Pane::PaneId(uint16_t id) noexcept +void Pane::Id(uint16_t id) noexcept { - _paneId = id; + _id = id; } // Method Description: @@ -1591,7 +1591,7 @@ void Pane::PaneId(uint16_t id) noexcept // - The ID of the pane we want to focus void Pane::FocusPane(const uint16_t id) { - if (_IsLeaf() && id == _paneId) + if (_IsLeaf() && id == _id) { _control.Focus(FocusState::Programmatic); } diff --git a/src/cascadia/TerminalApp/Pane.h b/src/cascadia/TerminalApp/Pane.h index 9502f309377..eb75e218cde 100644 --- a/src/cascadia/TerminalApp/Pane.h +++ b/src/cascadia/TerminalApp/Pane.h @@ -75,8 +75,8 @@ class Pane : public std::enable_shared_from_this void Maximize(std::shared_ptr zoomedPane); void Restore(std::shared_ptr zoomedPane); - uint16_t PaneId() noexcept; - void PaneId(uint16_t id) noexcept; + uint16_t Id() noexcept; + void Id(uint16_t id) noexcept; void FocusPane(const uint16_t id); WINRT_CALLBACK(Closed, winrt::Windows::Foundation::EventHandler); @@ -99,7 +99,7 @@ class Pane : public std::enable_shared_from_this winrt::Microsoft::Terminal::Settings::Model::SplitState _splitState{ winrt::Microsoft::Terminal::Settings::Model::SplitState::None }; float _desiredSplitPosition; - uint16_t _paneId; + uint16_t _id; bool _lastActive{ false }; std::optional _profile{ std::nullopt }; diff --git a/src/cascadia/TerminalApp/TerminalTab.cpp b/src/cascadia/TerminalApp/TerminalTab.cpp index b72c98e54d5..f1e7ba84e8d 100644 --- a/src/cascadia/TerminalApp/TerminalTab.cpp +++ b/src/cascadia/TerminalApp/TerminalTab.cpp @@ -29,7 +29,7 @@ namespace winrt::TerminalApp::implementation { _rootPane = std::make_shared(profile, control, true); - _rootPane->PaneId(_nextPaneId); + _rootPane->Id(_nextPaneId); _mruPanes.InsertAt(0, _nextPaneId); ++_nextPaneId; @@ -279,10 +279,10 @@ namespace winrt::TerminalApp::implementation // - void TerminalTab::SplitPane(SplitState splitType, const GUID& profile, TermControl& control) { - const auto activePaneId = _activePane->PaneId(); + const auto activePaneId = _activePane->Id(); auto [first, second] = _activePane->Split(splitType, profile, control); - first->PaneId(activePaneId); - second->PaneId(_nextPaneId); + first->Id(activePaneId); + second->Id(_nextPaneId); ++_nextPaneId; _activePane = first; _AttachEventHandlersToControl(control); @@ -470,7 +470,7 @@ namespace winrt::TerminalApp::implementation // We need to move the pane to the top of our mru list // If its already somewhere in the list, remove it first uint32_t mruPaneIndex; - const auto paneId = pane->PaneId(); + const auto paneId = pane->Id(); if (_mruPanes.IndexOf(paneId, mruPaneIndex)) { _mruPanes.RemoveAt(mruPaneIndex); @@ -522,7 +522,7 @@ namespace winrt::TerminalApp::implementation if (auto pane = weakPane.lock()) { uint32_t mruIndex; - if (tab->_mruPanes.IndexOf(pane->PaneId(), mruIndex)) + if (tab->_mruPanes.IndexOf(pane->Id(), mruIndex)) { tab->_mruPanes.RemoveAt(mruIndex); } From 6005d3917c4ce59a946108a92914a18c76fd3dd6 Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Mon, 30 Nov 2020 16:43:07 -0800 Subject: [PATCH 14/21] resource --- .../TerminalSettingsModel/Resources/en-US/Resources.resw | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw b/src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw index ccfeadbbb3c..8711074f9ac 100644 --- a/src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw @@ -189,6 +189,9 @@ up + + prev + Duplicate pane @@ -214,7 +217,7 @@ Move focus {0} - {0} will be replaced with one of the four directions "DirectionLeft", "DirectionRight", "DirectionUp", or "DirectionDown" + {0} will be replaced with one of the five directions "DirectionLeft", "DirectionRight", "DirectionUp", "DirectionDown" or "DirectionPrev" New tab From a1cb302352c8a555312e8aef69bcce9535c9d0e2 Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Tue, 1 Dec 2020 10:37:56 -0800 Subject: [PATCH 15/21] absorb remaining child's id, clear out id when splitting --- src/cascadia/TerminalApp/Pane.cpp | 10 ++++++++-- src/cascadia/TerminalApp/Pane.h | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/cascadia/TerminalApp/Pane.cpp b/src/cascadia/TerminalApp/Pane.cpp index afc00b667f6..3a80e53ddbf 100644 --- a/src/cascadia/TerminalApp/Pane.cpp +++ b/src/cascadia/TerminalApp/Pane.cpp @@ -655,9 +655,10 @@ void Pane::_CloseChild(const bool closeFirst) // inherited from us, so the flag will be set for both children. _borders = _firstChild->_borders & _secondChild->_borders; - // take the control and profile of the pane that _wasn't_ closed. + // take the control, profile and id of the pane that _wasn't_ closed. _control = remainingChild->_control; _profile = remainingChild->_profile; + _id = remainingChild->Id(); // Add our new event handler before revoking the old one. _connectionStateChangedToken = _control.ConnectionStateChanged({ this, &Pane::_ControlConnectionStateChangedHandler }); @@ -1493,6 +1494,9 @@ std::pair, std::shared_ptr> Pane::_Split(SplitState _SetupEntranceAnimation(); + // Clear out our ID, only leaves should have IDs + _id = {}; + return { _firstChild, _secondChild }; } @@ -1568,11 +1572,13 @@ void Pane::Restore(std::shared_ptr zoomedPane) // Method Description: // - Retrieves the ID of this pane +// - NOTE: The caller should make sure that this pane is a leaf, +// otherwise the ID value will not make sense (leaves have IDs, parents do not) // Return Value: // - The ID of this pane uint16_t Pane::Id() noexcept { - return _id; + return _id.value(); } // Method Description: diff --git a/src/cascadia/TerminalApp/Pane.h b/src/cascadia/TerminalApp/Pane.h index eb75e218cde..6b1e02444eb 100644 --- a/src/cascadia/TerminalApp/Pane.h +++ b/src/cascadia/TerminalApp/Pane.h @@ -99,7 +99,7 @@ class Pane : public std::enable_shared_from_this winrt::Microsoft::Terminal::Settings::Model::SplitState _splitState{ winrt::Microsoft::Terminal::Settings::Model::SplitState::None }; float _desiredSplitPosition; - uint16_t _id; + std::optional _id; bool _lastActive{ false }; std::optional _profile{ std::nullopt }; From 846c2fc64c2c233b36375ad60528e5286d0d81d6 Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Tue, 1 Dec 2020 16:27:54 -0800 Subject: [PATCH 16/21] template for DirectionMatchesSplit --- src/cascadia/TerminalApp/Pane.h | 41 ++++++--------------------------- 1 file changed, 7 insertions(+), 34 deletions(-) diff --git a/src/cascadia/TerminalApp/Pane.h b/src/cascadia/TerminalApp/Pane.h index 6b1e02444eb..1debee5f75f 100644 --- a/src/cascadia/TerminalApp/Pane.h +++ b/src/cascadia/TerminalApp/Pane.h @@ -162,13 +162,15 @@ class Pane : public std::enable_shared_from_this // - This is used for pane resizing (which will need a pane separator // that's perpendicular to the direction to be able to move the separator // in that direction). + // - Also used for moving focus between panes, which again happens _across_ a separator. // Arguments: // - direction: The Direction to compare // - splitType: The winrt::TerminalApp::SplitState to compare // Return Value: // - true iff the direction is perpendicular to the splitType. False for // winrt::TerminalApp::SplitState::None. - static constexpr bool DirectionMatchesSplit(const winrt::Microsoft::Terminal::Settings::Model::ResizeDirection& direction, + template + static constexpr bool DirectionMatchesSplit(const T& direction, const winrt::Microsoft::Terminal::Settings::Model::SplitState& splitType) { if (splitType == winrt::Microsoft::Terminal::Settings::Model::SplitState::None) @@ -177,42 +179,13 @@ class Pane : public std::enable_shared_from_this } else if (splitType == winrt::Microsoft::Terminal::Settings::Model::SplitState::Horizontal) { - return direction == winrt::Microsoft::Terminal::Settings::Model::ResizeDirection::Up || - direction == winrt::Microsoft::Terminal::Settings::Model::ResizeDirection::Down; + return direction == T::Up || + direction == T::Down; } else if (splitType == winrt::Microsoft::Terminal::Settings::Model::SplitState::Vertical) { - return direction == winrt::Microsoft::Terminal::Settings::Model::ResizeDirection::Left || - direction == winrt::Microsoft::Terminal::Settings::Model::ResizeDirection::Right; - } - return false; - } - - // Method Description - // - Exactly the same as the above DirectionMatchesSplit, but for FocusDirection instead of Resize - // - Used for moving focus between panes, which again happens _across_ a separator. - // Arguments: - // - direction: The Direction to compare - // - splitType: The winrt::TerminalApp::SplitState to compare - // Return Value: - // - true iff the direction is perpendicular to the splitType. False for - // winrt::TerminalApp::SplitState::None. - static constexpr bool DirectionMatchesSplit(const winrt::Microsoft::Terminal::Settings::Model::FocusDirection& direction, - const winrt::Microsoft::Terminal::Settings::Model::SplitState& splitType) - { - if (splitType == winrt::Microsoft::Terminal::Settings::Model::SplitState::None) - { - return false; - } - else if (splitType == winrt::Microsoft::Terminal::Settings::Model::SplitState::Horizontal) - { - return direction == winrt::Microsoft::Terminal::Settings::Model::FocusDirection::Up || - direction == winrt::Microsoft::Terminal::Settings::Model::FocusDirection::Down; - } - else if (splitType == winrt::Microsoft::Terminal::Settings::Model::SplitState::Vertical) - { - return direction == winrt::Microsoft::Terminal::Settings::Model::FocusDirection::Left || - direction == winrt::Microsoft::Terminal::Settings::Model::FocusDirection::Right; + return direction == T::Left || + direction == T::Right; } return false; } From 4e3b84bba25eb4afff75b21ac9940da6d90b277f Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Fri, 4 Dec 2020 15:05:58 -0800 Subject: [PATCH 17/21] comment, 'previous' instead of 'prev' --- src/cascadia/TerminalApp/TerminalTab.cpp | 1 + .../TerminalSettingsModel/Resources/en-US/Resources.resw | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cascadia/TerminalApp/TerminalTab.cpp b/src/cascadia/TerminalApp/TerminalTab.cpp index f1e7ba84e8d..6d8e424a8d2 100644 --- a/src/cascadia/TerminalApp/TerminalTab.cpp +++ b/src/cascadia/TerminalApp/TerminalTab.cpp @@ -279,6 +279,7 @@ namespace winrt::TerminalApp::implementation // - void TerminalTab::SplitPane(SplitState splitType, const GUID& profile, TermControl& control) { + // Make sure to take the ID before calling Split() - Split() will clear out the active pane's ID const auto activePaneId = _activePane->Id(); auto [first, second] = _activePane->Split(splitType, profile, control); first->Id(activePaneId); diff --git a/src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw b/src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw index 8711074f9ac..5b894a3b7b7 100644 --- a/src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw @@ -189,8 +189,8 @@ up - - prev + + previous Duplicate pane From 0478c8d12774037a05aa9f1f7ecfe4037a6f4e9c Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Mon, 7 Dec 2020 11:01:24 -0800 Subject: [PATCH 18/21] std vector instead of winrt --- src/cascadia/TerminalApp/TerminalTab.cpp | 29 ++++++++++++++---------- src/cascadia/TerminalApp/TerminalTab.h | 2 +- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/cascadia/TerminalApp/TerminalTab.cpp b/src/cascadia/TerminalApp/TerminalTab.cpp index 6d8e424a8d2..798d69f4548 100644 --- a/src/cascadia/TerminalApp/TerminalTab.cpp +++ b/src/cascadia/TerminalApp/TerminalTab.cpp @@ -24,13 +24,12 @@ namespace winrt namespace winrt::TerminalApp::implementation { - TerminalTab::TerminalTab(const GUID& profile, const TermControl& control) : - _mruPanes{ winrt::single_threaded_vector() } + TerminalTab::TerminalTab(const GUID& profile, const TermControl& control) { _rootPane = std::make_shared(profile, control, true); _rootPane->Id(_nextPaneId); - _mruPanes.InsertAt(0, _nextPaneId); + _mruPanes.insert(_mruPanes.begin(), _nextPaneId); ++_nextPaneId; _rootPane->Closed([=](auto&& /*s*/, auto&& /*e*/) { @@ -347,7 +346,7 @@ namespace winrt::TerminalApp::implementation if (direction == FocusDirection::Previous) { // To get to the previous pane, get the id of the previous pane and focus to that - _rootPane->FocusPane(_mruPanes.GetAt(1)); + _rootPane->FocusPane(_mruPanes.at(1)); } else { @@ -470,14 +469,16 @@ namespace winrt::TerminalApp::implementation // We need to move the pane to the top of our mru list // If its already somewhere in the list, remove it first - uint32_t mruPaneIndex; const auto paneId = pane->Id(); - if (_mruPanes.IndexOf(paneId, mruPaneIndex)) + for (auto i = _mruPanes.begin(); i != _mruPanes.end(); ++i) { - _mruPanes.RemoveAt(mruPaneIndex); + if (*i == paneId) + { + _mruPanes.erase(i); + break; + } } - _mruPanes.InsertAt(0, paneId); - + _mruPanes.insert(_mruPanes.begin(), paneId); // Raise our own ActivePaneChanged event. _ActivePaneChangedHandlers(); } @@ -522,11 +523,15 @@ namespace winrt::TerminalApp::implementation } if (auto pane = weakPane.lock()) { - uint32_t mruIndex; - if (tab->_mruPanes.IndexOf(pane->Id(), mruIndex)) + for (auto i = tab->_mruPanes.begin(); i != tab->_mruPanes.end(); ++i) { - tab->_mruPanes.RemoveAt(mruIndex); + if (*i == pane->Id()) + { + tab->_mruPanes.erase(i); + break; + } } + } } }); diff --git a/src/cascadia/TerminalApp/TerminalTab.h b/src/cascadia/TerminalApp/TerminalTab.h index 1d2c543de2a..c01c49e33f0 100644 --- a/src/cascadia/TerminalApp/TerminalTab.h +++ b/src/cascadia/TerminalApp/TerminalTab.h @@ -83,7 +83,7 @@ namespace winrt::TerminalApp::implementation winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _closeTabsAfterMenuItem{}; winrt::TerminalApp::TabHeaderControl _headerControl{}; - Windows::Foundation::Collections::IVector _mruPanes; + std::vector _mruPanes; uint16_t _nextPaneId{ 0 }; bool _receivedKeyDown{ false }; From 0fed566c54b771ea2720af54278aee6c5f1a68cc Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Mon, 7 Dec 2020 11:04:33 -0800 Subject: [PATCH 19/21] resize direction num mappings --- .../TerminalSettingsSerializationHelpers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h b/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h index bf2ad30872e..85286a95c84 100644 --- a/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h +++ b/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h @@ -345,7 +345,7 @@ JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::FocusDirection) // Possible ResizeDirection values JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::ResizeDirection) { - JSON_MAPPINGS(6) = { + JSON_MAPPINGS(4) = { pair_type{ "left", ValueType::Left }, pair_type{ "right", ValueType::Right }, pair_type{ "up", ValueType::Up }, From 4c964f6c13188d12fa898537a538424b0501b45b Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Tue, 8 Dec 2020 11:48:15 -0800 Subject: [PATCH 20/21] new resource for previous --- src/cascadia/TerminalSettingsModel/ActionArgs.cpp | 2 ++ .../TerminalSettingsModel/Resources/en-US/Resources.resw | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cascadia/TerminalSettingsModel/ActionArgs.cpp b/src/cascadia/TerminalSettingsModel/ActionArgs.cpp index 41237f5824d..55501055f15 100644 --- a/src/cascadia/TerminalSettingsModel/ActionArgs.cpp +++ b/src/cascadia/TerminalSettingsModel/ActionArgs.cpp @@ -183,6 +183,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation case FocusDirection::Down: directionString = RS_(L"DirectionDown"); break; + case FocusDirection::Previous: + return RS_(L"MoveFocusToLastUsedPane"); } return winrt::hstring{ fmt::format(std::wstring_view(RS_(L"MoveFocusWithArgCommandKey")), diff --git a/src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw b/src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw index 5b894a3b7b7..cd576ebded1 100644 --- a/src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw @@ -217,7 +217,10 @@ Move focus {0} - {0} will be replaced with one of the five directions "DirectionLeft", "DirectionRight", "DirectionUp", "DirectionDown" or "DirectionPrev" + {0} will be replaced with one of the four directions "DirectionLeft", "DirectionRight", "DirectionUp", "DirectionDown" + + + Move focus to the last used pane New tab From a46b655ac3c4151d436086bb8ed1a3b86d30abe1 Mon Sep 17 00:00:00 2001 From: Pankaj Bhojwani Date: Fri, 11 Dec 2020 10:20:45 -0800 Subject: [PATCH 21/21] code format --- src/cascadia/TerminalApp/TerminalTab.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cascadia/TerminalApp/TerminalTab.cpp b/src/cascadia/TerminalApp/TerminalTab.cpp index 798d69f4548..06a5002b8df 100644 --- a/src/cascadia/TerminalApp/TerminalTab.cpp +++ b/src/cascadia/TerminalApp/TerminalTab.cpp @@ -531,7 +531,6 @@ namespace winrt::TerminalApp::implementation break; } } - } } });