@@ -518,6 +518,11 @@ void EditorSettingsDialog::_update_shortcuts() {
518
518
}
519
519
}
520
520
521
+ String prev_selected_shortcut;
522
+ if (shortcuts->get_selected ()) {
523
+ prev_selected_shortcut = shortcuts->get_selected ()->get_text (0 );
524
+ }
525
+
521
526
shortcuts->clear ();
522
527
523
528
TreeItem *root = shortcuts->create_item ();
@@ -557,6 +562,9 @@ void EditorSettingsDialog::_update_shortcuts() {
557
562
558
563
TreeItem *item = _create_shortcut_treeitem (common_section, action_name, action_name, action_events, !same_as_defaults, true , collapse);
559
564
item->set_auto_translate_mode (0 , AUTO_TRANSLATE_MODE_DISABLED); // `ui_*` input action names are untranslatable identifiers.
565
+ if (!prev_selected_shortcut.is_empty () && action_name == prev_selected_shortcut) {
566
+ item->select (0 );
567
+ }
560
568
}
561
569
562
570
// Editor Shortcuts
@@ -616,7 +624,14 @@ void EditorSettingsDialog::_update_shortcuts() {
616
624
bool same_as_defaults = Shortcut::is_event_array_equal (original, shortcuts_array);
617
625
bool collapse = !collapsed.has (E) || (collapsed.has (E) && collapsed[E]);
618
626
619
- _create_shortcut_treeitem (section, E, sc->get_name (), shortcuts_array, !same_as_defaults, false , collapse);
627
+ TreeItem *shortcut_item = _create_shortcut_treeitem (section, E, sc->get_name (), shortcuts_array, !same_as_defaults, false , collapse);
628
+ if (!prev_selected_shortcut.is_empty () && sc->get_name () == prev_selected_shortcut) {
629
+ shortcut_item->select (0 );
630
+ }
631
+ }
632
+
633
+ if (!prev_selected_shortcut.is_empty ()) {
634
+ shortcuts->ensure_cursor_is_visible ();
620
635
}
621
636
622
637
// remove sections with no shortcuts
0 commit comments