From 2107402ba8f830fa49722f32230028431b436bc4 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Tue, 26 Dec 2023 09:46:34 -0500 Subject: [PATCH 1/3] Override clipboard paste event --- Flow.Launcher/MainWindow.xaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 88e95aa69..b65fbc7bb 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -221,6 +221,7 @@ Visibility="Visible"> + From db6e54160f96377113074c5ad6d5a6ca93deee63 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Tue, 26 Dec 2023 09:46:46 -0500 Subject: [PATCH 2/3] Handle clipboard paste event if text --- Flow.Launcher/MainWindow.xaml.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 3a914d488..461a64436 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -71,6 +71,15 @@ namespace Flow.Launcher App.API.CopyToClipboard(QueryTextBox.SelectedText, showDefaultNotification: false); } } + + private void OnPaste(object sender, ExecutedRoutedEventArgs e) + { + if (System.Windows.Clipboard.ContainsText()) + { + _viewModel.QueryText = System.Windows.Clipboard.GetText().Replace("\n", String.Empty).Replace("\r", String.Empty); + e.Handled = true; + } + } private async void OnClosing(object sender, CancelEventArgs e) { From e8d4afbf317b12bd7aba97f49da671e25b7d45fd Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Tue, 26 Dec 2023 09:59:01 -0500 Subject: [PATCH 3/3] Use ChangeQueryText func --- Flow.Launcher/MainWindow.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 461a64436..7d1a68125 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -76,7 +76,7 @@ namespace Flow.Launcher { if (System.Windows.Clipboard.ContainsText()) { - _viewModel.QueryText = System.Windows.Clipboard.GetText().Replace("\n", String.Empty).Replace("\r", String.Empty); + _viewModel.ChangeQueryText(System.Windows.Clipboard.GetText().Replace("\n", String.Empty).Replace("\r", String.Empty)); e.Handled = true; } }