diff options
author | Azeem Bande-Ali <azeemba> | 2021-12-09 13:09:50 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-12-09 13:15:19 +0300 |
commit | b8bad3549dcef0b761708ef9cc1f814ebedb3106 (patch) | |
tree | 6a0ac31a732d6345cbd6c2a8da7c907fa15642ec /source/blender/editors/interface/interface_handlers.c | |
parent | 65de17ece4626ac38ee990948548fbe9bff2e283 (diff) |
Fix T93519: handle prefix names in autocompletes
Autocomplete entires keep track of the length of the prefix
in `name_prefix_offset`. However, the name matching logic
was comparing the string including the prefix which resulted
in tab-completion not working (when the user didn't also type
in the prefix, typically two whitespaces).
This is fixed by passing in a char pointer after the end of
the prefix.
Additionally, some searchbox logic is moved. Previously,
`ui_searchbox_apply` would clear the entry which would mean
that `ui_searchbox_find_index` would never succeed. Now the
search box is only cleared if no match was found.
Differential Revision: https://developer.blender.org/D13483
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 637ab822067..f947572f41b 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3551,6 +3551,12 @@ static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data) if ((ui_searchbox_apply(but, data->searchbox) == false) && (ui_searchbox_find_index(data->searchbox, but->editstr) == -1) && !but_search->results_are_suggestions) { + + if (but->flag & UI_BUT_VALUE_CLEAR) { + /* It is valid for _VALUE_CLEAR flavor to have no active element + * (it's a valid way to unlink). */ + but->editstr[0] = '\0'; + } data->cancel = true; /* ensure menu (popup) too is closed! */ |