mirror of
https://github.com/godotengine/godot.git
synced 2025-10-28 20:24:41 +00:00
Split script navigation state and edit state
This commit is contained in:
parent
ef26618359
commit
14435ebcee
8 changed files with 43 additions and 21 deletions
|
|
@ -565,7 +565,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();
|
||||
|
|
@ -600,7 +600,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();
|
||||
|
|
@ -3374,7 +3374,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();
|
||||
|
|
@ -3385,11 +3385,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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue