fix: Ctrl+V trigger twice due to async operation (#249)

This commit is contained in:
leo 2024-07-09 18:53:36 +08:00
parent 446445ee73
commit c94f5877e3
No known key found for this signature in database

View file

@ -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;
}
}