summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorPaulb23 <p_batty@hotmail.co.uk>2016-03-07 02:32:51 +0000
committerPaulb23 <p_batty@hotmail.co.uk>2016-03-07 02:32:51 +0000
commitf19eea2f2d01cdfd671f16436eb639b46908b150 (patch)
treefc6ca163a85df405d7d8517af7a7c6e309eafd44 /scene/gui
parenta283d367a7cb54807e8c2e6015167feca9f604d1 (diff)
Enabled scrolling past end of file
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/text_edit.cpp6
-rw-r--r--scene/gui/text_edit.h5
2 files changed, 10 insertions, 1 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 5d7436517f..bb15659e70 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -290,7 +290,10 @@ void TextEdit::_update_scrollbars() {
int hscroll_rows = ((hmin.height-1)/get_row_height())+1;
int visible_rows = get_visible_rows();
int total_rows = text.size();
-
+ if (scroll_past_end_of_file_enabled) {
+ total_rows += get_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() + vmin.x;
@@ -3969,6 +3972,7 @@ TextEdit::TextEdit() {
tooltip_obj=NULL;
line_numbers=false;
next_operation_is_complex=false;
+ scroll_past_end_of_file_enabled=false;
auto_brace_completion_enabled=false;
brace_matching_enabled=false;
auto_indent=false;
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 44e780aaf3..8d0efc406a 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -211,6 +211,7 @@ class TextEdit : public Control {
bool undo_enabled;
bool line_numbers;
+ bool scroll_past_end_of_file_enabled;
bool auto_brace_completion_enabled;
bool brace_matching_enabled;
bool auto_indent;
@@ -322,6 +323,10 @@ public:
void set_line(int line, String new_text);
void backspace_at_cursor();
+ inline void set_scroll_pass_end_of_file(bool p_enabled) {
+ scroll_past_end_of_file_enabled = p_enabled;
+ update();
+ }
inline void set_auto_brace_completion(bool p_enabled) {
auto_brace_completion_enabled = p_enabled;
}