summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-10-06 13:32:08 +0200
committerGitHub <noreply@github.com>2018-10-06 13:32:08 +0200
commitdda6d805980cdeebd52d993904df701331de7b3b (patch)
treeee6e318ca501cf90669c72f04e2246d1e04b75f8 /scene/gui
parent86d384e95343f51a5ea724fd040173311fb337d3 (diff)
parent8a64a44e0efa466de4d359aeae2398b5337a8da9 (diff)
Merge pull request #22742 from YeldhamDev/textedit_margin_scroll
Fix TextEdit margin start spacing with two scrollbars
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/text_edit.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index df0798b42c..32580a5ae6 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;
}