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] 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) {