From f8df6b1c708ba23e62e52fbdebf0ef057de5bdd4 Mon Sep 17 00:00:00 2001 From: kit Date: Tue, 16 Jul 2024 11:19:58 -0400 Subject: [PATCH] Fix ScriptEditor scrolling horizontally on reopen --- scene/gui/text_edit.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 9cc59f1def77..5eeee76d9938 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -5913,6 +5913,11 @@ void TextEdit::adjust_viewport_to_caret(int p_caret) { } visible_width -= 20; // Give it a little more space. + if (visible_width <= 0) { + // Not resized yet. + return; + } + Vector2i caret_pos; // Get position of the start of caret.