diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-10-09 15:19:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-09 15:19:15 +0200 |
commit | 438e32d6520c4fc37676bfdc2d287178a13c326c (patch) | |
tree | fbaacfbc2dc3361ca7f11ec2f7358c6255329594 /scene/gui/text_edit.cpp | |
parent | cb7e4aa6d46ec247c7fc41104e4459a062cce77c (diff) | |
parent | b07dfd75eaa3a89aefda9c26e33f91d8eaa80fc8 (diff) |
Merge pull request #11941 from Paulb23/members_selected_scroll_issue_11648
Consistant scroll when using members overview, issue 11648
Diffstat (limited to 'scene/gui/text_edit.cpp')
-rw-r--r-- | scene/gui/text_edit.cpp | 8 |
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; } |