Skip to content

Commit

Permalink
Allow shift+enter in Terminal Chat's text box (#17993)
Browse files Browse the repository at this point in the history
You can now press shift+enter in the Terminal Chat query box to enter
newlines

Closes #17940
  • Loading branch information
PankajBhojwani authored Oct 4, 2024
1 parent 91c5aa9 commit c989f86
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cascadia/QueryExtension/ExtensionPalette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ namespace winrt::Microsoft::Terminal::Query::Extension::implementation
const auto key = e.OriginalKey();
const auto coreWindow = CoreWindow::GetForCurrentThread();
const auto ctrlDown = WI_IsFlagSet(coreWindow.GetKeyState(winrt::Windows::System::VirtualKey::Control), CoreVirtualKeyStates::Down);
const auto shiftDown = WI_IsFlagSet(coreWindow.GetKeyState(winrt::Windows::System::VirtualKey::Shift), CoreVirtualKeyStates::Down);

if (key == VirtualKey::Escape)
{
Expand All @@ -393,7 +394,7 @@ namespace winrt::Microsoft::Terminal::Query::Extension::implementation

e.Handled(true);
}
else if (key == VirtualKey::Enter)
else if (key == VirtualKey::Enter && !shiftDown)
{
if (const auto& textBox = e.OriginalSource().try_as<TextBox>())
{
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/QueryExtension/ExtensionPalette.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@
Height="100"
Margin="16,0,16,4"
Padding="18,8,8,8"
AcceptsReturn="True"
IsSpellCheckEnabled="False"
PlaceholderText="{x:Bind QueryBoxPlaceholderText}"
Text=""
Expand Down

0 comments on commit c989f86

Please sign in to comment.