MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / _update_history_pos

Method _update_history_pos

editor/script/script_editor_plugin.cpp:3881–3920  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3879}
3880
3881void 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
3922void ScriptEditor::_history_forward() {
3923 if (history_pos < history.size() - 1) {

Callers

nothing calls this directly

Calls 13

set_scrollMethod · 0.80
set_focusedMethod · 0.80
get_navigation_stateMethod · 0.45
get_scrollMethod · 0.45
set_current_tabMethod · 0.45
set_edit_stateMethod · 0.45
ensure_focusMethod · 0.45
get_edited_resourceMethod · 0.45
is_validMethod · 0.45
validateMethod · 0.45

Tested by

no test coverage detected