diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 1cef81305b7..479480011c2 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -7340,7 +7340,7 @@ void TextEdit::_update_scrollbars() { } int visible_width = size.width - theme_cache.style_normal->get_minimum_size().width; - int total_width = (draw_placeholder ? placeholder_max_width : text.get_max_width()) + vmin.x + gutters_width + gutter_padding; + int total_width = (draw_placeholder ? placeholder_max_width : text.get_max_width()) + gutters_width + gutter_padding; if (draw_minimap) { total_width += minimap_width; diff --git a/tests/scene/test_text_edit.h b/tests/scene/test_text_edit.h index 840a04becf0..9c9ade44451 100644 --- a/tests/scene/test_text_edit.h +++ b/tests/scene/test_text_edit.h @@ -3913,7 +3913,8 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_h_scroll() == 0); text_edit->set_h_scroll(10000000); - CHECK(text_edit->get_h_scroll() == 314); + CHECK(text_edit->get_h_scroll() == 306); + CHECK(text_edit->get_h_scroll_bar()->get_combined_minimum_size().x == 8); text_edit->set_h_scroll(-100); CHECK(text_edit->get_h_scroll() == 0);