| 3879 | } |
| 3880 | |
| 3881 | void ScriptEditor::_update_history_pos(int p_new_pos) { |
| 3882 | Node *n = tab_container->get_current_tab_control(); |
| 3883 | |
| 3884 | if (Object::cast_to<ScriptEditorBase>(n)) { |
| 3885 | history.write[history_pos].state = Object::cast_to<ScriptEditorBase>(n)->get_navigation_state(); |
| 3886 | } |
| 3887 | if (Object::cast_to<EditorHelp>(n)) { |
| 3888 | history.write[history_pos].state = Object::cast_to<EditorHelp>(n)->get_scroll(); |
| 3889 | } |
| 3890 | |
| 3891 | history_pos = p_new_pos; |
| 3892 | tab_container->set_current_tab(tab_container->get_tab_idx_from_control(history[history_pos].control)); |
| 3893 | |
| 3894 | n = history[history_pos].control; |
| 3895 | |
| 3896 | ScriptEditorBase *seb = Object::cast_to<ScriptEditorBase>(n); |
| 3897 | if (seb) { |
| 3898 | lock_history = true; |
| 3899 | seb->set_edit_state(history[history_pos].state); |
| 3900 | seb->ensure_focus(); |
| 3901 | |
| 3902 | Ref<Script> scr = seb->get_edited_resource(); |
| 3903 | if (scr.is_valid()) { |
| 3904 | notify_script_changed(scr); |
| 3905 | } |
| 3906 | |
| 3907 | seb->validate(); |
| 3908 | } |
| 3909 | |
| 3910 | EditorHelp *eh = Object::cast_to<EditorHelp>(n); |
| 3911 | if (eh) { |
| 3912 | eh->set_scroll(history[history_pos].state); |
| 3913 | eh->set_focused(); |
| 3914 | } |
| 3915 | |
| 3916 | n->set_meta("__editor_pass", ++edit_pass); |
| 3917 | _update_script_names(); |
| 3918 | _update_history_arrows(); |
| 3919 | _update_selected_editor_menu(); |
| 3920 | } |
| 3921 | |
| 3922 | void ScriptEditor::_history_forward() { |
| 3923 | if (history_pos < history.size() - 1) { |
nothing calls this directly
no test coverage detected