Skip to content

Commit

Permalink
Merge pull request #83286 from bronsonholden/fix-text-edit-hscroll-ji…
Browse files Browse the repository at this point in the history
…tter

Remove vertical scrollbar padding from line width calc
  • Loading branch information
akien-mga committed Oct 17, 2023
2 parents 8f70b2e + b15dd3e commit 3e8dc9d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scene/gui/text_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion tests/scene/test_text_edit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3e8dc9d

Please sign in to comment.