Enable moving back to the root level in the command palette (#8051)
This commit adds functionality so that users can move back from sub menu whenever they want. As a result, users no longer have to close command palette and open it again to get all commands again. Closes #7910
This commit is contained in:
parent
c0c23291b8
commit
341bb4f91e
|
@ -428,6 +428,25 @@ namespace winrt::TerminalApp::implementation
|
|||
_dispatchCommand(e.ClickedItem().try_as<Command>());
|
||||
}
|
||||
|
||||
// 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:
|
||||
// - <none>
|
||||
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
|
||||
|
|
|
@ -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& sender, Windows::UI::Xaml::RoutedEventArgs const&);
|
||||
|
||||
void _updateFilteredActions();
|
||||
|
||||
std::vector<Microsoft::Terminal::Settings::Model::Command> _collectFilteredActions();
|
||||
|
|
|
@ -186,16 +186,36 @@ the MIT License. See LICENSE in the project root for license information. -->
|
|||
>
|
||||
</TextBlock>
|
||||
|
||||
<TextBlock
|
||||
Padding="16, 0, 16, 4"
|
||||
x:Name="_parentCommandText"
|
||||
FontStyle="Italic"
|
||||
Visibility="{x:Bind ParentCommandName,
|
||||
Mode=OneWay,
|
||||
Converter={StaticResource ParentCommandVisibilityConverter}}"
|
||||
Grid.Row="1"
|
||||
Text="{x:Bind ParentCommandName, Mode=OneWay}">
|
||||
</TextBlock>
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Padding="16, 0, 16, 4"
|
||||
Grid.Row="1"
|
||||
Visibility="{x:Bind ParentCommandName,
|
||||
Mode=OneWay,
|
||||
Converter={StaticResource ParentCommandVisibilityConverter}}">
|
||||
|
||||
<Button
|
||||
Background="Transparent"
|
||||
x:Name="_parentCommandBackButton"
|
||||
x:Uid="ParentCommandBackButton"
|
||||
Click="_moveBackButtonClicked"
|
||||
ClickMode="Press"
|
||||
VerticalAlignment="Center">
|
||||
<FontIcon
|
||||
FontSize="12"
|
||||
FontFamily="Segoe MDL2 Assets"
|
||||
Glyph="">
|
||||
</FontIcon>
|
||||
</Button>
|
||||
|
||||
<TextBlock
|
||||
Padding="16, 0, 16, 4"
|
||||
x:Name="_parentCommandText"
|
||||
FontStyle="Italic"
|
||||
Grid.Row="1"
|
||||
Text="{x:Bind ParentCommandName, Mode=OneWay}"
|
||||
VerticalAlignment="Center">
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock
|
||||
Padding="16"
|
||||
|
|
|
@ -482,4 +482,10 @@
|
|||
<data name="FailedToWriteToSettings" xml:space="preserve">
|
||||
<value>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.</value>
|
||||
</data>
|
||||
<data name="ParentCommandBackButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Back</value>
|
||||
</data>
|
||||
<data name="ParentCommandBackButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Back</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
Loading…
Reference in a new issue