From 019f4ab403e2d761fb92dc3a29a786a03dfb9090 Mon Sep 17 00:00:00 2001 From: aaronp64 Date: Wed, 20 Aug 2025 17:13:18 -0400 Subject: [PATCH] Update TextEdit to use center alignment for inline objects Updated to use center alignment instead of top to avoid shifting the line of text up when adding an object. --- scene/gui/text_edit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 5208d175d9..356d0ba22c 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -312,7 +312,7 @@ void TextEdit::Text::invalidate_cache(int p_line, bool p_text_changed) { float width_ratio = info["width_ratio"]; String left_string = text_with_ime.substr(from, start - from); text_line.data_buf->add_string(left_string, font, font_size, language); - text_line.data_buf->add_object(info, Vector2(font_height * width_ratio, font_height), INLINE_ALIGNMENT_TOP, 0); + text_line.data_buf->add_object(info, Vector2(font_height * width_ratio, font_height), INLINE_ALIGNMENT_CENTER, 0); from = start; } } @@ -329,7 +329,7 @@ void TextEdit::Text::invalidate_cache(int p_line, bool p_text_changed) { } Dictionary info = key; float width_ratio = info["width_ratio"]; - text_line.data_buf->resize_object(info, Vector2(font_height * width_ratio, font_height), INLINE_ALIGNMENT_TOP, 0); + text_line.data_buf->resize_object(info, Vector2(font_height * width_ratio, font_height), INLINE_ALIGNMENT_CENTER, 0); } } }