Skip to content

Commit 6aeec62

Browse files
authored
Merge pull request #2465 from Flow-Launcher/strip-newlines-for-multi-line-paste
Strip newlines for multi line paste
2 parents ea5a85d + e8d4afb commit 6aeec62

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Flow.Launcher/MainWindow.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@
221221
Visibility="Visible">
222222
<TextBox.CommandBindings>
223223
<CommandBinding Command="ApplicationCommands.Copy" Executed="OnCopy" />
224+
<CommandBinding Command="ApplicationCommands.Paste" Executed="OnPaste" />
224225
</TextBox.CommandBindings>
225226
<TextBox.ContextMenu>
226227
<ContextMenu MinWidth="160">

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ private void OnCopy(object sender, ExecutedRoutedEventArgs e)
7171
App.API.CopyToClipboard(QueryTextBox.SelectedText, showDefaultNotification: false);
7272
}
7373
}
74+
75+
private void OnPaste(object sender, ExecutedRoutedEventArgs e)
76+
{
77+
if (System.Windows.Clipboard.ContainsText())
78+
{
79+
_viewModel.ChangeQueryText(System.Windows.Clipboard.GetText().Replace("\n", String.Empty).Replace("\r", String.Empty));
80+
e.Handled = true;
81+
}
82+
}
7483

7584
private async void OnClosing(object sender, CancelEventArgs e)
7685
{

0 commit comments

Comments
 (0)