summaryrefslogtreecommitdiff
path: root/editor/code_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/code_editor.cpp')
-rw-r--r--editor/code_editor.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 06a425bab9..42c5c7c4da 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -1528,7 +1528,7 @@ void CodeTextEditor::_notification(int p_what) {
} break;
case NOTIFICATION_THEME_CHANGED: {
if (toggle_scripts_button->is_visible()) {
- toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? get_icon("Back", "EditorIcons") : get_icon("Forward", "EditorIcons"));
+ update_toggle_scripts_button();
}
_update_font();
} break;
@@ -1537,6 +1537,9 @@ void CodeTextEditor::_notification(int p_what) {
add_constant_override("separation", 4 * EDSCALE);
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
+ if (toggle_scripts_button->is_visible()) {
+ update_toggle_scripts_button();
+ }
set_process_input(is_visible_in_tree());
} break;
default:
@@ -1570,6 +1573,7 @@ void CodeTextEditor::goto_next_bookmark() {
if (line >= bmarks[bmarks.size() - 1]) {
text_editor->unfold_line(bmarks[0]);
text_editor->cursor_set_line(bmarks[0]);
+ text_editor->center_viewport_to_cursor();
} else {
for (List<int>::Element *E = bmarks.front(); E; E = E->next()) {
int bline = E->get();
@@ -1595,6 +1599,7 @@ void CodeTextEditor::goto_prev_bookmark() {
if (line <= bmarks[0]) {
text_editor->unfold_line(bmarks[bmarks.size() - 1]);
text_editor->cursor_set_line(bmarks[bmarks.size() - 1]);
+ text_editor->center_viewport_to_cursor();
} else {
for (List<int>::Element *E = bmarks.back(); E; E = E->prev()) {
int bline = E->get();
@@ -1649,6 +1654,11 @@ void CodeTextEditor::show_toggle_scripts_button() {
toggle_scripts_button->show();
}
+void CodeTextEditor::update_toggle_scripts_button() {
+ toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? get_icon("Back", "EditorIcons") : get_icon("Forward", "EditorIcons"));
+ toggle_scripts_button->set_tooltip(TTR("Toggle Scripts Panel") + " (" + ED_GET_SHORTCUT("script_editor/toggle_scripts_panel")->get_as_text() + ")");
+}
+
CodeTextEditor::CodeTextEditor() {
code_complete_func = NULL;
@@ -1693,7 +1703,6 @@ CodeTextEditor::CodeTextEditor() {
toggle_scripts_button = memnew(ToolButton);
toggle_scripts_button->connect("pressed", this, "_toggle_scripts_pressed");
status_bar->add_child(toggle_scripts_button);
- toggle_scripts_button->set_shortcut(ED_SHORTCUT("script_editor/toggle_scripts_panel", TTR("Toggle Scripts Panel"), KEY_MASK_CMD | KEY_BACKSLASH));
toggle_scripts_button->hide();
// Error