Merge pull request #3969 from Paulb23/scroll_past_end_of_file
Enabled scrolling past end of file in text editor.
This commit is contained in:
commit
9157a13aef
4 changed files with 14 additions and 1 deletions
|
@ -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;
|
||||
|
@ -3990,6 +3993,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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue