Skip to content

Commit 019f4ab

Browse files
committed
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.
1 parent be04069 commit 019f4ab

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scene/gui/text_edit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ void TextEdit::Text::invalidate_cache(int p_line, bool p_text_changed) {
312312
float width_ratio = info["width_ratio"];
313313
String left_string = text_with_ime.substr(from, start - from);
314314
text_line.data_buf->add_string(left_string, font, font_size, language);
315-
text_line.data_buf->add_object(info, Vector2(font_height * width_ratio, font_height), INLINE_ALIGNMENT_TOP, 0);
315+
text_line.data_buf->add_object(info, Vector2(font_height * width_ratio, font_height), INLINE_ALIGNMENT_CENTER, 0);
316316
from = start;
317317
}
318318
}
@@ -329,7 +329,7 @@ void TextEdit::Text::invalidate_cache(int p_line, bool p_text_changed) {
329329
}
330330
Dictionary info = key;
331331
float width_ratio = info["width_ratio"];
332-
text_line.data_buf->resize_object(info, Vector2(font_height * width_ratio, font_height), INLINE_ALIGNMENT_TOP, 0);
332+
text_line.data_buf->resize_object(info, Vector2(font_height * width_ratio, font_height), INLINE_ALIGNMENT_CENTER, 0);
333333
}
334334
}
335335
}

0 commit comments

Comments
 (0)