From b07dfd75eaa3a89aefda9c26e33f91d8eaa80fc8 Mon Sep 17 00:00:00 2001 From: Paulb23 Date: Sun, 8 Oct 2017 14:29:27 +0100 Subject: Consistant scroll when using members overview, issue 11648 --- editor/plugins/script_editor_plugin.cpp | 6 +++++- editor/plugins/script_text_editor.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'editor/plugins') diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 5e66488afb..477d440f28 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1278,7 +1278,11 @@ void ScriptEditor::_members_overview_selected(int p_idx) { if (!se) { return; } - se->goto_line(members_overview->get_item_metadata(p_idx)); + Dictionary state; + state["scroll_position"] = members_overview->get_item_metadata(p_idx); + state["column"] = 0; + state["row"] = members_overview->get_item_metadata(p_idx); + se->set_edit_state(state); se->ensure_focus(); } diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index a24856dad7..adf65c11e1 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -529,9 +529,9 @@ void ScriptTextEditor::ensure_focus() { void ScriptTextEditor::set_edit_state(const Variant &p_state) { Dictionary state = p_state; - code_editor->get_text_edit()->set_v_scroll(state["scroll_position"]); code_editor->get_text_edit()->cursor_set_column(state["column"]); code_editor->get_text_edit()->cursor_set_line(state["row"]); + code_editor->get_text_edit()->set_v_scroll(state["scroll_position"]); code_editor->get_text_edit()->grab_focus(); //int scroll_pos; -- cgit v1.2.3