diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-06-30 18:40:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-30 18:40:43 +0200 |
commit | 84e9e58084d12771d04cd2ece16b32720867fcbd (patch) | |
tree | 61a55ea52854eefd41a5ccae8e8720e981dafac0 | |
parent | 5f2295f2dfdbf1ac4e63b562e4cef71f2fda4036 (diff) | |
parent | 55d706c352fd3cbb25418201053bc0d688ee88d4 (diff) |
Merge pull request #39990 from follower/revert-fuzzy-help-search
Revert "Adds fuzzy search for help search dialog"
-rw-r--r-- | editor/editor_help_search.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index d2b9405552..4392538737 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -332,17 +332,10 @@ bool EditorHelpSearch::Runner::_phase_match_classes() { if (search_flags & SEARCH_METHODS) { for (int i = 0; i < class_doc.methods.size(); i++) { String method_name = (search_flags & SEARCH_CASE_SENSITIVE) ? class_doc.methods[i].name : class_doc.methods[i].name.to_lower(); - String aux_term = (search_flags & SEARCH_CASE_SENSITIVE) ? term : term.to_lower(); - - if (aux_term.begins_with(".")) { - aux_term = aux_term.right(1); - } - - if (aux_term.ends_with("(")) { - aux_term = aux_term.left(aux_term.length() - 1).strip_edges(); - } - - if (aux_term.is_subsequence_of(method_name)) { + if (method_name.find(term) > -1 || + (term.begins_with(".") && method_name.begins_with(term.right(1))) || + (term.ends_with("(") && method_name.ends_with(term.left(term.length() - 1).strip_edges())) || + (term.begins_with(".") && term.ends_with("(") && method_name == term.substr(1, term.length() - 2).strip_edges())) { match.methods.push_back(const_cast<DocData::MethodDoc *>(&class_doc.methods[i])); } } @@ -448,9 +441,9 @@ bool EditorHelpSearch::Runner::_phase_select_match() { bool EditorHelpSearch::Runner::_match_string(const String &p_term, const String &p_string) const { if (search_flags & SEARCH_CASE_SENSITIVE) { - return p_term.is_subsequence_of(p_string); + return p_string.find(p_term) > -1; } else { - return p_term.is_subsequence_ofi(p_string); + return p_string.findn(p_term) > -1; } } |