summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scene/gui/text_edit.cpp6
-rw-r--r--scene/gui/text_edit.h5
-rw-r--r--tools/editor/editor_settings.cpp2
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp2
4 files changed, 14 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;
}
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index 47ef87cfb1..fda51423d2 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -404,6 +404,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("text_editor/brace_mismatch_color",Color(1,0.2,0.2));
set("text_editor/current_line_color",Color(0.3,0.5,0.8,0.15));
+ set("text_editor/scroll_past_end_of_file", false);
+
set("text_editor/idle_parse_delay",2);
set("text_editor/create_signal_callbacks",true);
set("text_editor/autosave_interval_secs",0);
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index e3dce0b36a..4be8b3f95c 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -1927,6 +1927,7 @@ void ScriptEditor::edit(const Ref<Script>& p_script) {
ScriptTextEditor *ste = memnew( ScriptTextEditor );
ste->set_edited_script(p_script);
ste->get_text_edit()->set_tooltip_request_func(this,"_get_debug_tooltip",ste);
+ ste->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file"));
ste->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete"));
ste->get_text_edit()->set_callhint_settings(
EditorSettings::get_singleton()->get("text_editor/put_callhint_tooltip_below_current_line"),
@@ -2064,6 +2065,7 @@ void ScriptEditor::_editor_settings_changed() {
continue;
ste->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete"));
+ ste->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file"));
}
}