Merge pull request #116585 from jinyangcruise/fix_symbol_jump
Fix symbol jump history navigation issue.
This commit is contained in:
commit
db25be3646
13 changed files with 183 additions and 32 deletions
|
|
@ -203,12 +203,6 @@ void ScriptEditor::_goto_script_line(Ref<RefCounted> p_script, int p_line) {
|
|||
if (scr.is_valid() && (scr->has_source_code() || scr->get_path().is_resource_file())) {
|
||||
if (edit(p_script, p_line, 0)) {
|
||||
EditorNode::get_singleton()->push_item(p_script.ptr());
|
||||
|
||||
if (TextEditorBase *current = Object::cast_to<TextEditorBase>(_get_current_editor())) {
|
||||
current->goto_line_centered(p_line);
|
||||
}
|
||||
|
||||
_save_history();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -316,7 +310,9 @@ void ScriptEditor::_save_history() {
|
|||
Node *n = tab_container->get_current_tab_control();
|
||||
|
||||
if (Object::cast_to<TextEditorBase>(n)) {
|
||||
history.write[history_pos].state = Object::cast_to<TextEditorBase>(n)->get_navigation_state();
|
||||
Dictionary nav_state = Object::cast_to<TextEditorBase>(n)->get_navigation_state();
|
||||
nav_state["ensure_caret_visible"] = true;
|
||||
history.write[history_pos].state = nav_state;
|
||||
}
|
||||
if (Object::cast_to<EditorHelp>(n)) {
|
||||
history.write[history_pos].state = Object::cast_to<EditorHelp>(n)->get_scroll();
|
||||
|
|
@ -375,7 +371,9 @@ void ScriptEditor::_go_to_tab(int p_idx) {
|
|||
Node *n = tab_container->get_current_tab_control();
|
||||
|
||||
if (Object::cast_to<TextEditorBase>(n)) {
|
||||
history.write[history_pos].state = Object::cast_to<TextEditorBase>(n)->get_navigation_state();
|
||||
Dictionary nav_state = Object::cast_to<TextEditorBase>(n)->get_navigation_state();
|
||||
nav_state["ensure_caret_visible"] = true;
|
||||
history.write[history_pos].state = nav_state;
|
||||
}
|
||||
if (Object::cast_to<EditorHelp>(n)) {
|
||||
history.write[history_pos].state = Object::cast_to<EditorHelp>(n)->get_scroll();
|
||||
|
|
@ -2231,7 +2229,7 @@ bool ScriptEditor::edit(const Ref<Resource> &p_resource, int p_line, int p_col,
|
|||
}
|
||||
|
||||
if (p_line >= 0) {
|
||||
teb->goto_line(p_line, p_col);
|
||||
teb->goto_line_centered(p_line, p_col);
|
||||
}
|
||||
} else if (tab_container->get_current_tab() != i) {
|
||||
_go_to_tab(i);
|
||||
|
|
@ -2358,7 +2356,7 @@ bool ScriptEditor::edit(const Ref<Resource> &p_resource, int p_line, int p_col,
|
|||
|
||||
if (TextEditorBase *teb = Object::cast_to<TextEditorBase>(seb)) {
|
||||
if (p_line >= 0) {
|
||||
teb->goto_line(p_line, p_col);
|
||||
teb->goto_line_centered(p_line, p_col);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3442,7 +3440,9 @@ void ScriptEditor::_update_history_pos(int p_new_pos) {
|
|||
Node *n = tab_container->get_current_tab_control();
|
||||
|
||||
if (Object::cast_to<TextEditorBase>(n)) {
|
||||
history.write[history_pos].state = Object::cast_to<TextEditorBase>(n)->get_navigation_state();
|
||||
Dictionary nav_state = Object::cast_to<TextEditorBase>(n)->get_navigation_state();
|
||||
nav_state["ensure_caret_visible"] = true;
|
||||
history.write[history_pos].state = nav_state;
|
||||
}
|
||||
if (Object::cast_to<EditorHelp>(n)) {
|
||||
history.write[history_pos].state = Object::cast_to<EditorHelp>(n)->get_scroll();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue