diff --git a/Source/Engine/UI/GUI/Common/TextBoxBase.cs b/Source/Engine/UI/GUI/Common/TextBoxBase.cs index f2492ac55e..ee6aaa7bcd 100644 --- a/Source/Engine/UI/GUI/Common/TextBoxBase.cs +++ b/Source/Engine/UI/GUI/Common/TextBoxBase.cs @@ -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); } /// @@ -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();