Enabled scrolling past end of file
(cherry picked from commit f19eea2f2d
)
This commit is contained in:
parent
53aa9cd51a
commit
da356eca0f
|
@ -290,6 +290,9 @@ void TextEdit::_update_scrollbars() {
|
||||||
int hscroll_rows = ((hmin.height-1)/get_row_height())+1;
|
int hscroll_rows = ((hmin.height-1)/get_row_height())+1;
|
||||||
int visible_rows = get_visible_rows();
|
int visible_rows = get_visible_rows();
|
||||||
int total_rows = text.size();
|
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 vscroll_pixels = v_scroll->get_combined_minimum_size().width;
|
||||||
int visible_width = size.width - cache.style_normal->get_minimum_size().width;
|
int visible_width = size.width - cache.style_normal->get_minimum_size().width;
|
||||||
|
@ -3969,6 +3972,7 @@ TextEdit::TextEdit() {
|
||||||
tooltip_obj=NULL;
|
tooltip_obj=NULL;
|
||||||
line_numbers=false;
|
line_numbers=false;
|
||||||
next_operation_is_complex=false;
|
next_operation_is_complex=false;
|
||||||
|
scroll_past_end_of_file_enabled=false;
|
||||||
auto_brace_completion_enabled=false;
|
auto_brace_completion_enabled=false;
|
||||||
brace_matching_enabled=false;
|
brace_matching_enabled=false;
|
||||||
auto_indent=false;
|
auto_indent=false;
|
||||||
|
|
|
@ -211,6 +211,7 @@ class TextEdit : public Control {
|
||||||
bool undo_enabled;
|
bool undo_enabled;
|
||||||
bool line_numbers;
|
bool line_numbers;
|
||||||
|
|
||||||
|
bool scroll_past_end_of_file_enabled;
|
||||||
bool auto_brace_completion_enabled;
|
bool auto_brace_completion_enabled;
|
||||||
bool brace_matching_enabled;
|
bool brace_matching_enabled;
|
||||||
bool auto_indent;
|
bool auto_indent;
|
||||||
|
@ -322,6 +323,10 @@ public:
|
||||||
void set_line(int line, String new_text);
|
void set_line(int line, String new_text);
|
||||||
void backspace_at_cursor();
|
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) {
|
inline void set_auto_brace_completion(bool p_enabled) {
|
||||||
auto_brace_completion_enabled = p_enabled;
|
auto_brace_completion_enabled = p_enabled;
|
||||||
}
|
}
|
||||||
|
|
|
@ -482,6 +482,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/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/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/idle_parse_delay",2);
|
||||||
set("text_editor/create_signal_callbacks",true);
|
set("text_editor/create_signal_callbacks",true);
|
||||||
set("text_editor/autosave_interval_secs",0);
|
set("text_editor/autosave_interval_secs",0);
|
||||||
|
|
|
@ -1927,6 +1927,7 @@ void ScriptEditor::edit(const Ref<Script>& p_script) {
|
||||||
ScriptTextEditor *ste = memnew( ScriptTextEditor );
|
ScriptTextEditor *ste = memnew( ScriptTextEditor );
|
||||||
ste->set_edited_script(p_script);
|
ste->set_edited_script(p_script);
|
||||||
ste->get_text_edit()->set_tooltip_request_func(this,"_get_debug_tooltip",ste);
|
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_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete"));
|
||||||
ste->get_text_edit()->set_callhint_settings(
|
ste->get_text_edit()->set_callhint_settings(
|
||||||
EditorSettings::get_singleton()->get("text_editor/put_callhint_tooltip_below_current_line"),
|
EditorSettings::get_singleton()->get("text_editor/put_callhint_tooltip_below_current_line"),
|
||||||
|
@ -2064,6 +2065,7 @@ void ScriptEditor::_editor_settings_changed() {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ste->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete"));
|
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"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue