From c94f5877e304a2ce29f6809d4f8ffd0e9ec8319d Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 9 Jul 2024 18:53:36 +0800 Subject: [PATCH] fix: `Ctrl+V` trigger twice due to async operation (#249) --- src/Views/CommitMessageTextBox.axaml.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Views/CommitMessageTextBox.axaml.cs b/src/Views/CommitMessageTextBox.axaml.cs index 1b458ede..96de1148 100644 --- a/src/Views/CommitMessageTextBox.axaml.cs +++ b/src/Views/CommitMessageTextBox.axaml.cs @@ -127,6 +127,8 @@ namespace SourceGit.Views } else if (e.Key == Key.V && ((OperatingSystem.IsMacOS() && e.KeyModifiers == KeyModifiers.Meta) || (!OperatingSystem.IsMacOS() && e.KeyModifiers == KeyModifiers.Control))) { + e.Handled = true; + var text = await App.GetClipboardTextAsync(); if (!string.IsNullOrWhiteSpace(text)) { @@ -152,8 +154,6 @@ namespace SourceGit.Views SubjectEditor.Paste(text.ReplaceLineEndings(" ")); } } - - e.Handled = true; } }