Improve formatting of TreeSearch
This commit is contained in:
parent
f7d546fc3c
commit
e8de3adc50
|
@ -356,12 +356,13 @@ void TreeSearch::_select_next_match() {
|
|||
if (matching_entries.size() == 0) {
|
||||
return;
|
||||
}
|
||||
TreeItem *selected = tree_reference->get_selected(); // we care about a single item here.
|
||||
TreeItem *selected = tree_reference->get_selected();
|
||||
if (!selected) {
|
||||
_select_first_match();
|
||||
return;
|
||||
}
|
||||
|
||||
// find [selected_idx] among ordered_tree_items
|
||||
int selected_idx = -1;
|
||||
for (int i = 0; i < ordered_tree_items.size(); i++) {
|
||||
if (ordered_tree_items[i] == selected) {
|
||||
|
@ -370,7 +371,7 @@ void TreeSearch::_select_next_match() {
|
|||
}
|
||||
}
|
||||
|
||||
// find the best fitting entry.
|
||||
// find first entry after [selected_idx].
|
||||
for (int i = MAX(0, selected_idx) + 1; i < ordered_tree_items.size(); i++) {
|
||||
TreeItem *item = ordered_tree_items[i];
|
||||
if (_vector_has_bsearch(matching_entries, item)) {
|
||||
|
@ -378,7 +379,8 @@ void TreeSearch::_select_next_match() {
|
|||
return;
|
||||
}
|
||||
}
|
||||
_select_first_match(); // wrap around.
|
||||
// wrap around.
|
||||
_select_first_match();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
|
Loading…
Reference in New Issue