Merge branch 'fix-textbox-bugs' of git://github.com/stefnotch/FlaxEngine into stefnotch-fix-textbox-bugs

This commit is contained in:
Wojtek Figat
2021-04-28 10:40:27 +02:00

View File

@@ -522,9 +522,7 @@ namespace FlaxEngine.GUI
if (string.IsNullOrEmpty(clipboardText)) if (string.IsNullOrEmpty(clipboardText))
return; return;
var right = SelectionRight;
Insert(clipboardText); Insert(clipboardText);
SetSelection(Mathf.Max(right, 0) + clipboardText.Length);
} }
/// <summary> /// <summary>
@@ -640,11 +638,13 @@ namespace FlaxEngine.GUI
{ {
var left = SelectionLeft >= 0 ? SelectionLeft : 0; var left = SelectionLeft >= 0 ? SelectionLeft : 0;
if (HasSelection) if (HasSelection)
{
_text = _text.Remove(left, selectionLength); _text = _text.Remove(left, selectionLength);
SetSelection(left);
}
_text = _text.Insert(left, str); _text = _text.Insert(left, str);
SetSelection(left + 1); SetSelection(left + str.Length);
} }
OnTextChanged(); OnTextChanged();