summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorPaulb23 <p_batty@hotmail.co.uk>2017-10-08 14:29:27 +0100
committerPaulb23 <p_batty@hotmail.co.uk>2017-10-08 14:29:27 +0100
commitb07dfd75eaa3a89aefda9c26e33f91d8eaa80fc8 (patch)
treed033d978cf660cd377880af38974b5255602d1fc /scene
parentbd10a002402de6e3a69a17af604784ea7f5b3330 (diff)
Consistant scroll when using members overview, issue 11648
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/text_edit.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index d14d3ef947..33c29547be 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -4287,6 +4287,14 @@ int TextEdit::get_v_scroll() const {
}
void TextEdit::set_v_scroll(int p_scroll) {
+ if (p_scroll < 0) {
+ p_scroll = 0;
+ }
+ if (!scroll_past_end_of_file_enabled) {
+ if (p_scroll + get_visible_rows() > get_line_count()) {
+ p_scroll = get_line_count() - get_visible_rows();
+ }
+ }
v_scroll->set_value(p_scroll);
cursor.line_ofs = p_scroll;
}