diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-11-05 11:51:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-05 11:51:59 +0100 |
commit | a0ac0804ca34317faea1ee6dbc66037178b0f727 (patch) | |
tree | 65f1c3304ec19f2389def1cfa5fbb16568b24103 /editor | |
parent | 3149ef084b9aaae33d74cfb28592ed95726fb88d (diff) | |
parent | 8f204d78fd20d0ad1008fa1643b863c863c0a0be (diff) |
Merge pull request #12640 from poke1024/createnode-ui
In Create New Node, always select and show best (shortest) match
Diffstat (limited to 'editor')
-rw-r--r-- | editor/create_dialog.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index a1f66318cc..95b4f7e982 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -171,6 +171,9 @@ void CreateDialog::add_type(const String &p_type, HashMap<String, TreeItem *> &p bool is_search_subsequence = search_box->get_text().is_subsequence_ofi(p_type); String to_select_type = *to_select ? (*to_select)->get_text(0) : ""; bool current_item_is_preffered = ClassDB::is_parent_class(p_type, preferred_search_result_type) && !ClassDB::is_parent_class(to_select_type, preferred_search_result_type); + if (*to_select && p_type.length() < (*to_select)->get_text(0).length()) { + current_item_is_preffered = true; + } if (((!*to_select || current_item_is_preffered) && is_search_subsequence) || search_box->get_text() == p_type) { *to_select = item; @@ -290,6 +293,7 @@ void CreateDialog::_update_search() { if (to_select) { to_select->select(0); + search_options->scroll_to_item(to_select); favorite->set_disabled(false); favorite->set_pressed(favorite_list.find(to_select->get_text(0)) != -1); } |