From e8c0501949e074199441fa965d113421c264c7c9 Mon Sep 17 00:00:00 2001 From: nogunumo Date: Tue, 3 Nov 2020 21:15:27 +0900 Subject: [PATCH 1/4] From scratch --- src/cascadia/TerminalApp/CommandPalette.cpp | 19 +++++++++ src/cascadia/TerminalApp/CommandPalette.h | 2 + src/cascadia/TerminalApp/CommandPalette.xaml | 40 ++++++++++++++----- .../Resources/en-US/Resources.resw | 6 +++ 4 files changed, 57 insertions(+), 10 deletions(-) diff --git a/src/cascadia/TerminalApp/CommandPalette.cpp b/src/cascadia/TerminalApp/CommandPalette.cpp index d0129706746..8d13dfa97c0 100644 --- a/src/cascadia/TerminalApp/CommandPalette.cpp +++ b/src/cascadia/TerminalApp/CommandPalette.cpp @@ -426,6 +426,25 @@ namespace winrt::TerminalApp::implementation _dispatchCommand(e.ClickedItem().try_as()); } + // Method Description: + // This event is called when the user clicks on an ChevronLeft button right + // next to the ParentCommandName (e.g. New Tab...) above the subcommands list. + // It'll go up a level when the users click the button. + // Arguments: + // - sender: the button that got clicked + // Return Value: + // - + void CommandPalette::_moveBackButtonClicked(Windows::Foundation::IInspectable const& /*sender*/, + Windows::UI::Xaml::RoutedEventArgs const&) + { + _nestedActionStack.Clear(); + ParentCommandName(L""); + _currentNestedCommands.Clear(); + _searchBox().Focus(FocusState::Programmatic); + _updateFilteredActions(); + _filteredActionsView().SelectedIndex(0); + } + // Method Description: // - This is called when the user selects a command with subcommands. It // will update our UI to now display the list of subcommands instead, and diff --git a/src/cascadia/TerminalApp/CommandPalette.h b/src/cascadia/TerminalApp/CommandPalette.h index 1dad812de26..52160ead1e8 100644 --- a/src/cascadia/TerminalApp/CommandPalette.h +++ b/src/cascadia/TerminalApp/CommandPalette.h @@ -81,6 +81,8 @@ namespace winrt::TerminalApp::implementation void _listItemClicked(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Controls::ItemClickEventArgs const& e); + void _moveBackButtonClicked(Windows::Foundation::IInspectable const&, Windows::UI::Xaml::RoutedEventArgs const&); + void _updateFilteredActions(); std::vector _collectFilteredActions(); diff --git a/src/cascadia/TerminalApp/CommandPalette.xaml b/src/cascadia/TerminalApp/CommandPalette.xaml index 6e8f332abb0..394884a0fa5 100644 --- a/src/cascadia/TerminalApp/CommandPalette.xaml +++ b/src/cascadia/TerminalApp/CommandPalette.xaml @@ -186,16 +186,36 @@ the MIT License. See LICENSE in the project root for license information. --> > - - + + + + + + + We could not write to your settings file. Check the permissions on that file to ensure that the read-only flag is not set and that write access is granted. + + Back + + + Back + From 56252bcb85227c0971745d3851367ca3620b86f0 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Tue, 3 Nov 2020 08:28:36 -0600 Subject: [PATCH 2/4] Update src/cascadia/TerminalApp/CommandPalette.cpp this should fix the code formatting --- src/cascadia/TerminalApp/CommandPalette.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cascadia/TerminalApp/CommandPalette.cpp b/src/cascadia/TerminalApp/CommandPalette.cpp index 8d13dfa97c0..042f303b04a 100644 --- a/src/cascadia/TerminalApp/CommandPalette.cpp +++ b/src/cascadia/TerminalApp/CommandPalette.cpp @@ -435,7 +435,7 @@ namespace winrt::TerminalApp::implementation // Return Value: // - void CommandPalette::_moveBackButtonClicked(Windows::Foundation::IInspectable const& /*sender*/, - Windows::UI::Xaml::RoutedEventArgs const&) + Windows::UI::Xaml::RoutedEventArgs const&) { _nestedActionStack.Clear(); ParentCommandName(L""); From 9f00bb5faf9fc5443c0943b9aa9491de63251111 Mon Sep 17 00:00:00 2001 From: nogunumo Date: Wed, 4 Nov 2020 00:16:52 +0900 Subject: [PATCH 3/4] add sender --- src/cascadia/TerminalApp/CommandPalette.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cascadia/TerminalApp/CommandPalette.h b/src/cascadia/TerminalApp/CommandPalette.h index 52160ead1e8..0df2ad5becc 100644 --- a/src/cascadia/TerminalApp/CommandPalette.h +++ b/src/cascadia/TerminalApp/CommandPalette.h @@ -81,7 +81,7 @@ namespace winrt::TerminalApp::implementation void _listItemClicked(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Controls::ItemClickEventArgs const& e); - void _moveBackButtonClicked(Windows::Foundation::IInspectable const&, Windows::UI::Xaml::RoutedEventArgs const&); + void _moveBackButtonClicked(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const&); void _updateFilteredActions(); From 2a19d71cb6cd9976af5da69ddd27ec84b3ff6204 Mon Sep 17 00:00:00 2001 From: nogunumo Date: Wed, 4 Nov 2020 00:49:47 +0900 Subject: [PATCH 4/4] code format --- src/cascadia/TerminalApp/CommandPalette.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cascadia/TerminalApp/CommandPalette.cpp b/src/cascadia/TerminalApp/CommandPalette.cpp index 042f303b04a..17db0bb513d 100644 --- a/src/cascadia/TerminalApp/CommandPalette.cpp +++ b/src/cascadia/TerminalApp/CommandPalette.cpp @@ -427,13 +427,13 @@ namespace winrt::TerminalApp::implementation } // Method Description: - // This event is called when the user clicks on an ChevronLeft button right - // next to the ParentCommandName (e.g. New Tab...) above the subcommands list. - // It'll go up a level when the users click the button. - // Arguments: - // - sender: the button that got clicked - // Return Value: - // - + // This event is called when the user clicks on an ChevronLeft button right + // next to the ParentCommandName (e.g. New Tab...) above the subcommands list. + // It'll go up a level when the users click the button. + // Arguments: + // - sender: the button that got clicked + // Return Value: + // - void CommandPalette::_moveBackButtonClicked(Windows::Foundation::IInspectable const& /*sender*/, Windows::UI::Xaml::RoutedEventArgs const&) {