Skip to content

Commit

Permalink
Apply the fix from #3518 to pasting from context menu. Closes #2926.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbialobr committed Mar 22, 2017
1 parent cfe3d0d commit 4973b71
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions GitUI/SpellChecker/EditNetSpell.cs
Expand Up @@ -668,8 +668,7 @@ private void TextBox_KeyDown(object sender, KeyEventArgs e)
// handle paste from clipboard (Ctrl+V, Shift+Ins)
if((e.Control && e.KeyCode == Keys.V) || (e.Shift && e.KeyCode == Keys.Insert))
{
// insert only text
((RichTextBox)sender).Paste(DataFormats.GetFormat(DataFormats.UnicodeText));
PasteTextFromClipboard();
e.Handled = true;
return;
}
Expand All @@ -689,6 +688,12 @@ private void TextBox_KeyDown(object sender, KeyEventArgs e)
OnKeyDown(e);
}

private void PasteTextFromClipboard()
{
// insert only text
TextBox.Paste(DataFormats.GetFormat(DataFormats.UnicodeText));
}

private void TextBox_KeyPress(object sender, KeyPressEventArgs e)
{
OnKeyPress(e);
Expand Down Expand Up @@ -748,11 +753,7 @@ private void CopyMenuItemdClick(object sender, EventArgs e)
private void PasteMenuItemClick(object sender, EventArgs e)
{
if (!Clipboard.ContainsText()) return;
// remove image data from clipboard
string text = Clipboard.GetText();
Clipboard.SetText(text);

TextBox.Paste();
PasteTextFromClipboard();
CheckSpelling();
}

Expand Down

0 comments on commit 4973b71

Please sign in to comment.