From 1f970670b778abc9018701f0cacac37aa66b57fc Mon Sep 17 00:00:00 2001 From: Tom Evans Date: Sun, 26 Apr 2020 12:23:00 -0500 Subject: [PATCH] Fixed shuffling editor help tabs The indexes for the ScriptEditorItemData entries were not getting updated after sorting. This would cause a page to be open but with a different tab selected. Whenever _update_script_names was called next, it would correct this indexing. Now we correct it immediately following the tab sort. (cherry picked from commit fe53c1b0bd14afbc7c33297ca4176d6de1110686) --- editor/plugins/script_editor_plugin.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index db48421b546..c03f901e800 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1922,6 +1922,10 @@ void ScriptEditor::_update_script_names() { if (new_cur_tab == -1 && sedata[i].index == cur_tab) { new_cur_tab = i; } + // Update index of sd entries for sorted order + _ScriptEditorItemData sd = sedata[i]; + sd.index = i; + sedata.set(i, sd); } tab_container->set_current_tab(new_prev_tab); tab_container->set_current_tab(new_cur_tab);