Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move paste code check in its right place #2127

Merged
merged 3 commits into from Aug 19, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 13 additions & 8 deletions WalletWasabi.Gui/Controls/NoparaPasswordBox.cs
Expand Up @@ -210,9 +210,10 @@ protected override async void OnKeyDown(KeyEventArgs e)
return;
}

bool paste = false;
if (e.Key == Key.V)
{
bool paste = false;

if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
if (e.Modifiers == InputModifiers.Control) // Prevent paste.
Expand All @@ -231,17 +232,21 @@ protected override async void OnKeyDown(KeyEventArgs e)
paste = true;
}
}
}

if (paste)
{
string text = await Application.Current.Clipboard.GetTextAsync();
if (!string.IsNullOrEmpty(text))
if (paste)
{
e.Handled = OnTextInput(text);
string text = await Application.Current.Clipboard.GetTextAsync();
if (!string.IsNullOrEmpty(text))
{
e.Handled = OnTextInput(text);
}

PaintText();
yahiheb marked this conversation as resolved.
Show resolved Hide resolved
return;
}
}
else if (Sb.Length > 0)

if (Sb.Length > 0)
{
if (e.Key == Key.Back) // Backspace button -> delete from the end.
{
Expand Down