Docs: note why fnmatch doesn't use escaping
This commit is contained in:
@@ -183,8 +183,13 @@ eUIListFilterResult uiListNameFilter::operator()(const PointerRNA & /*itemptr*/,
|
||||
return UI_LIST_ITEM_FILTER_MATCHES;
|
||||
}
|
||||
|
||||
/* Case-insensitive! */
|
||||
if (fnmatch(filter_, name.c_str(), FNM_CASEFOLD | FNM_NOESCAPE) == 0) {
|
||||
/* Use `fnmatch` for shell-style globing.
|
||||
* - Case-insensitive.
|
||||
* - Don't handle escape characters as "special" characters are not expected in names.
|
||||
* Unlike shell input - `\` should be treated like any other character.
|
||||
*/
|
||||
const int fn_flag = FNM_CASEFOLD | FNM_NOESCAPE;
|
||||
if (fnmatch(filter_, name.c_str(), fn_flag) == 0) {
|
||||
return UI_LIST_ITEM_FILTER_MATCHES;
|
||||
}
|
||||
return UI_LIST_ITEM_FILTER_MISMATCHES;
|
||||
|
||||
@@ -985,6 +985,11 @@ static bool outliner_element_visible_get(const Scene *scene,
|
||||
|
||||
static bool outliner_filter_has_name(TreeElement *te, const char *name, int flags)
|
||||
{
|
||||
/* Use `fnmatch` for shell-style globing.
|
||||
* - Case-insensitive (optionally).
|
||||
* - Don't handle escape characters as "special" characters are not expected in names.
|
||||
* Unlike shell input - `\` should be treated like any other character.
|
||||
*/
|
||||
int fn_flag = FNM_NOESCAPE;
|
||||
|
||||
if ((flags & SO_FIND_CASE_SENSITIVE) == 0) {
|
||||
|
||||
Reference in New Issue
Block a user