From 8a64a44e0efa466de4d359aeae2398b5337a8da9 Mon Sep 17 00:00:00 2001 From: Michael Alexsander Silva Dias Date: Thu, 4 Oct 2018 19:38:08 -0300 Subject: [PATCH] Fix TextEdit margin start spacing with two scrollbars --- scene/gui/text_edit.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index c390c60a8cd..bbd93695474 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -334,15 +334,12 @@ void TextEdit::_update_scrollbars() { h_scroll->set_begin(Point2(0, size.height - hmin.height)); h_scroll->set_end(Point2(size.width - vmin.width, size.height)); - int hscroll_rows = ((hmin.height - 1) / get_row_height()) + 1; int visible_rows = get_visible_rows(); - int total_rows = get_total_visible_rows(); if (scroll_past_end_of_file_enabled) { total_rows += visible_rows - 1; } - int vscroll_pixels = v_scroll->get_combined_minimum_size().width; int visible_width = size.width - cache.style_normal->get_minimum_size().width; int total_width = text.get_max_width(true) + vmin.x; @@ -367,12 +364,12 @@ void TextEdit::_update_scrollbars() { } else { - if (total_rows > visible_rows && total_width <= visible_width - vscroll_pixels) { + if (total_rows > visible_rows && total_width <= visible_width) { //thanks yessopie for this clever bit of logic use_hscroll = false; } - if (total_rows <= visible_rows - hscroll_rows && total_width > visible_width) { + if (total_rows <= visible_rows && total_width > visible_width) { //thanks yessopie for this clever bit of logic use_vscroll = false; }