From 37ed8afb30a5106197ace61f220daecd64e8b288 Mon Sep 17 00:00:00 2001 From: stefnotch Date: Sat, 24 Apr 2021 10:19:20 +0200 Subject: [PATCH] Fix selecting and then pasting text Now the caret isn't off by 1 character anymore --- Source/Engine/UI/GUI/Common/TextBoxBase.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/Engine/UI/GUI/Common/TextBoxBase.cs b/Source/Engine/UI/GUI/Common/TextBoxBase.cs index 2e4ef51e3..ac0b3b55f 100644 --- a/Source/Engine/UI/GUI/Common/TextBoxBase.cs +++ b/Source/Engine/UI/GUI/Common/TextBoxBase.cs @@ -504,9 +504,7 @@ namespace FlaxEngine.GUI if (string.IsNullOrEmpty(clipboardText)) return; - var right = SelectionRight; Insert(clipboardText); - SetSelection(Mathf.Max(right, 0) + clipboardText.Length); } /// @@ -626,7 +624,7 @@ namespace FlaxEngine.GUI _text = _text.Insert(left, str); - SetSelection(left + 1); + SetSelection(left + str.Length); } OnTextChanged();