summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGer Hean <gerhean@live.com>2022-01-04 13:26:39 +0800
committerGer Hean <gerhean@live.com>2022-02-05 18:49:32 +0800
commit472c6cbfdc6269c096fc6891b85ca424e08300c8 (patch)
tree4e4141abdf2baa9034c5c3b9a5e8071140f5db35
parentdf1724470d1cff4f67aeb4c0d039114373aeb001 (diff)
Fix shortcut collapse after edit
-rw-r--r--editor/editor_settings_dialog.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/editor/editor_settings_dialog.cpp b/editor/editor_settings_dialog.cpp
index 2520d662c5..687d3eb3d1 100644
--- a/editor/editor_settings_dialog.cpp
+++ b/editor/editor_settings_dialog.cpp
@@ -327,13 +327,15 @@ void EditorSettingsDialog::_update_shortcuts() {
// Try go down tree
TreeItem *ti_next = ti->get_first_child();
- // Try go across tree
+ // Try go to the next node via in-order traversal
if (!ti_next) {
- ti_next = ti->get_next();
- }
- // Try go up tree, to next node
- if (!ti_next) {
- ti_next = ti->get_parent()->get_next();
+ ti_next = ti;
+ while (ti_next && !ti_next->get_next()) {
+ ti_next = ti_next->get_parent();
+ }
+ if (ti_next) {
+ ti_next = ti_next->get_next();
+ }
}
ti = ti_next;