summaryrefslogtreecommitdiff
path: root/editor/plugins/script_editor_plugin.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-10-05 08:30:49 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-10-05 08:30:49 +0200
commit121e1df55b813d944bab0319f70723d2b8783723 (patch)
tree051b30abe53e991e2c3593e8b64d0aeaba9a96b2 /editor/plugins/script_editor_plugin.cpp
parent2c94470dd1c15357acf261c3d7126a9a247d51c6 (diff)
parent14435ebcee2b0e6a90f9303771246fb2f9cf8777 (diff)
Merge pull request #66300 from KoBeWi/📝🧭
Split script navigation state and edit state
Diffstat (limited to 'editor/plugins/script_editor_plugin.cpp')
-rw-r--r--editor/plugins/script_editor_plugin.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index a3f2c2509f..67813a3635 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -566,7 +566,7 @@ void ScriptEditor::_save_history() {
Node *n = tab_container->get_current_tab_control();
if (Object::cast_to<ScriptEditorBase>(n)) {
- history.write[history_pos].state = Object::cast_to<ScriptEditorBase>(n)->get_edit_state();
+ history.write[history_pos].state = Object::cast_to<ScriptEditorBase>(n)->get_navigation_state();
}
if (Object::cast_to<EditorHelp>(n)) {
history.write[history_pos].state = Object::cast_to<EditorHelp>(n)->get_scroll();
@@ -601,7 +601,7 @@ void ScriptEditor::_go_to_tab(int p_idx) {
Node *n = tab_container->get_current_tab_control();
if (Object::cast_to<ScriptEditorBase>(n)) {
- history.write[history_pos].state = Object::cast_to<ScriptEditorBase>(n)->get_edit_state();
+ history.write[history_pos].state = Object::cast_to<ScriptEditorBase>(n)->get_navigation_state();
}
if (Object::cast_to<EditorHelp>(n)) {
history.write[history_pos].state = Object::cast_to<EditorHelp>(n)->get_scroll();
@@ -3360,7 +3360,7 @@ void ScriptEditor::_update_history_pos(int p_new_pos) {
Node *n = tab_container->get_current_tab_control();
if (Object::cast_to<ScriptEditorBase>(n)) {
- history.write[history_pos].state = Object::cast_to<ScriptEditorBase>(n)->get_edit_state();
+ history.write[history_pos].state = Object::cast_to<ScriptEditorBase>(n)->get_navigation_state();
}
if (Object::cast_to<EditorHelp>(n)) {
history.write[history_pos].state = Object::cast_to<EditorHelp>(n)->get_scroll();
@@ -3371,11 +3371,12 @@ void ScriptEditor::_update_history_pos(int p_new_pos) {
n = history[history_pos].control;
- if (Object::cast_to<ScriptEditorBase>(n)) {
- Object::cast_to<ScriptEditorBase>(n)->set_edit_state(history[history_pos].state);
- Object::cast_to<ScriptEditorBase>(n)->ensure_focus();
+ ScriptEditorBase *seb = Object::cast_to<ScriptEditorBase>(n);
+ if (seb) {
+ seb->set_edit_state(history[history_pos].state);
+ seb->ensure_focus();
- Ref<Script> script = Object::cast_to<ScriptEditorBase>(n)->get_edited_resource();
+ Ref<Script> script = seb->get_edited_resource();
if (script != nullptr) {
notify_script_changed(script);
}