Skip to content

Commit

Permalink
Merge branch 'fix-textbox-bugs' of git://github.com/stefnotch/FlaxEng…
Browse files Browse the repository at this point in the history
…ine into stefnotch-fix-textbox-bugs
  • Loading branch information
mafiesto4 committed Apr 28, 2021
2 parents d9f3915 + 3c2c95d commit 3eef855
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Source/Engine/UI/GUI/Common/TextBoxBase.cs
Expand Up @@ -522,9 +522,7 @@ public virtual void Paste()
if (string.IsNullOrEmpty(clipboardText))
return;

var right = SelectionRight;
Insert(clipboardText);
SetSelection(Mathf.Max(right, 0) + clipboardText.Length);
}

/// <summary>
Expand Down Expand Up @@ -640,11 +638,13 @@ public virtual void Insert(string str)
{
var left = SelectionLeft >= 0 ? SelectionLeft : 0;
if (HasSelection)
{
_text = _text.Remove(left, selectionLength);

SetSelection(left);
}
_text = _text.Insert(left, str);

SetSelection(left + 1);
SetSelection(left + str.Length);
}

OnTextChanged();
Expand Down

0 comments on commit 3eef855

Please sign in to comment.