From 3641886ebfb94f414b44ab0b22a9aebe32c30073 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Sat, 27 Apr 2024 09:16:03 -0500 Subject: [PATCH] Fix textbox caret showing on empty string. --- Source/Engine/UI/GUI/Common/TextBoxBase.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/Engine/UI/GUI/Common/TextBoxBase.cs b/Source/Engine/UI/GUI/Common/TextBoxBase.cs index 460d6f4b1..2db8c33e2 100644 --- a/Source/Engine/UI/GUI/Common/TextBoxBase.cs +++ b/Source/Engine/UI/GUI/Common/TextBoxBase.cs @@ -1203,7 +1203,7 @@ namespace FlaxEngine.GUI if (base.OnMouseDown(location, button)) return true; - if (button == MouseButton.Left && _text.Length > 0 && _isSelectable) + if (button == MouseButton.Left && _isSelectable) { Focus(); OnSelectingBegin(); @@ -1219,6 +1219,10 @@ namespace FlaxEngine.GUI else SetSelection(_selectionStart, hitPos); } + else if (string.IsNullOrEmpty(_text)) + { + SetSelection(0); + } else { SetSelection(hitPos);