diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-12-01 22:20:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-01 22:20:31 +0100 |
commit | d2858e23713314f286875c45b6bd176daf860171 (patch) | |
tree | 18d72e610e1cec9603f9dc4462d2232af32f6f5b /editor | |
parent | e9b709a5dbbe46d73b121f595cceb08ca31fcc36 (diff) | |
parent | f4d0e598a7500c667028c408c51cdbfb8acaa212 (diff) |
Merge pull request #34048 from KoBeWi/center_of_the_bookmark
Center Script Editor when jumping to bookmarks/breakpoints
Diffstat (limited to 'editor')
-rw-r--r-- | editor/code_editor.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 16780a795f..e3138dc1e5 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -1565,6 +1565,7 @@ void CodeTextEditor::goto_next_bookmark() { if (bline > line) { text_editor->unfold_line(bline); text_editor->cursor_set_line(bline); + text_editor->center_viewport_to_cursor(); return; } } @@ -1589,6 +1590,7 @@ void CodeTextEditor::goto_prev_bookmark() { if (bline < line) { text_editor->unfold_line(bline); text_editor->cursor_set_line(bline); + text_editor->center_viewport_to_cursor(); return; } } diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index f63445dab8..2e41801637 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -707,6 +707,7 @@ void ScriptTextEditor::_bookmark_item_pressed(int p_idx) { _edit_option(bookmarks_menu->get_item_id(p_idx)); } else { code_editor->goto_line(bookmarks_menu->get_item_metadata(p_idx)); + code_editor->get_text_edit()->call_deferred("center_viewport_to_cursor"); //Need to be deferred, because goto uses call_deferred(). } } @@ -856,6 +857,7 @@ void ScriptTextEditor::_breakpoint_item_pressed(int p_idx) { _edit_option(breakpoints_menu->get_item_id(p_idx)); } else { code_editor->goto_line(breakpoints_menu->get_item_metadata(p_idx)); + code_editor->get_text_edit()->call_deferred("center_viewport_to_cursor"); //Need to be deferred, because goto uses call_deferred(). } } @@ -1307,6 +1309,7 @@ void ScriptTextEditor::_edit_option(int p_op) { if (bline > line) { tx->unfold_line(bline); tx->cursor_set_line(bline); + tx->center_viewport_to_cursor(); return; } } @@ -1332,6 +1335,7 @@ void ScriptTextEditor::_edit_option(int p_op) { if (bline < line) { tx->unfold_line(bline); tx->cursor_set_line(bline); + tx->center_viewport_to_cursor(); return; } } |