From b07dfd75eaa3a89aefda9c26e33f91d8eaa80fc8 Mon Sep 17 00:00:00 2001 From: Paulb23 Date: Sun, 8 Oct 2017 14:29:27 +0100 Subject: Consistant scroll when using members overview, issue 11648 --- scene/gui/text_edit.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'scene/gui/text_edit.cpp') diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index d14d3ef94..33c29547b 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; } -- cgit v1.2.3-70-g09d2