Skip to content

Commit

Permalink
Teach command palette to fill in selected commandline upon right arrow (
Browse files Browse the repository at this point in the history
#11069)

Closes #11049
  • Loading branch information
Don-Vito authored Aug 30, 2021
1 parent e4c5e8b commit 871b8de
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/cascadia/TerminalApp/CommandPalette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,17 @@ namespace winrt::TerminalApp::implementation
_PreviewActionHandlers(*this, actionPaletteItem.Command());
}
}
else if (_currentMode == CommandPaletteMode::CommandlineMode)
{
if (filteredCommand)
{
SearchBoxPlaceholderText(filteredCommand.Item().Name());
}
else
{
SearchBoxPlaceholderText(RS_(L"CmdPalCommandlinePrompt"));
}
}
}

void CommandPalette::_previewKeyDownHandler(IInspectable const& /*sender*/,
Expand Down Expand Up @@ -364,6 +375,17 @@ namespace winrt::TerminalApp::implementation
_searchBox().PasteFromClipboard();
e.Handled(true);
}
else if (key == VirtualKey::Right && _currentMode == CommandPaletteMode::CommandlineMode)
{
if (const auto command{ _filteredActionsView().SelectedItem().try_as<winrt::TerminalApp::FilteredCommand>() })
{
_searchBox().Text(command.Item().Name());
_searchBox().Select(_searchBox().Text().size(), 0);
_searchBox().Focus(FocusState::Programmatic);
_filteredActionsView().SelectedIndex(-1);
e.Handled(true);
}
}
}

// Method Description:
Expand Down

0 comments on commit 871b8de

Please sign in to comment.