From 495de38c48c467a3627b791f01177a0e19f04e78 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Fri, 22 Mar 2024 12:09:41 -0500 Subject: [PATCH] Make TargetViewOffset only go to bottom of text. Add Scroll to Carrot for new lines. --- Source/Engine/UI/GUI/Common/TextBoxBase.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Engine/UI/GUI/Common/TextBoxBase.cs b/Source/Engine/UI/GUI/Common/TextBoxBase.cs index a7393a121..460d6f4b1 100644 --- a/Source/Engine/UI/GUI/Common/TextBoxBase.cs +++ b/Source/Engine/UI/GUI/Common/TextBoxBase.cs @@ -1265,7 +1265,7 @@ namespace FlaxEngine.GUI // Multiline scroll if (IsMultiline && _text.Length != 0 && IsMultilineScrollable) { - TargetViewOffset = Float2.Clamp(_targetViewOffset - new Float2(0, delta * 10.0f), Float2.Zero, new Float2(_targetViewOffset.X, _textSize.Y)); + TargetViewOffset = Float2.Clamp(_targetViewOffset - new Float2(0, delta * 10.0f), Float2.Zero, new Float2(_targetViewOffset.X, _textSize.Y - Height)); return true; } @@ -1456,6 +1456,7 @@ namespace FlaxEngine.GUI { // Insert new line Insert('\n'); + ScrollToCaret(); } else if (!IsNavFocused) {