Browse Source

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.
Tom Evans 5 years ago
parent
commit
fe53c1b0bd
1 changed files with 4 additions and 0 deletions
  1. 4 0
      editor/plugins/script_editor_plugin.cpp

+ 4 - 0
editor/plugins/script_editor_plugin.cpp

@@ -1866,6 +1866,10 @@ void ScriptEditor::_update_script_names() {
 			if (new_cur_tab == -1 && sedata[i].index == cur_tab) {
 			if (new_cur_tab == -1 && sedata[i].index == cur_tab) {
 				new_cur_tab = i;
 				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_prev_tab);
 		tab_container->set_current_tab(new_cur_tab);
 		tab_container->set_current_tab(new_cur_tab);