Procházet zdrojové kódy

LibGUI: Add match_case parameter to TextDocument::find_all()

Itamar před 3 roky
rodič
revize
a12385dc4b

+ 2 - 2
Userland/Libraries/LibGUI/TextDocument.cpp

@@ -580,13 +580,13 @@ TextRange TextDocument::find_previous(StringView needle, const TextPosition& sta
     return {};
 }
 
-Vector<TextRange> TextDocument::find_all(StringView needle, bool regmatch)
+Vector<TextRange> TextDocument::find_all(StringView needle, bool regmatch, bool match_case)
 {
     Vector<TextRange> ranges;
 
     TextPosition position;
     for (;;) {
-        auto range = find_next(needle, position, SearchShouldWrap::No, regmatch);
+        auto range = find_next(needle, position, SearchShouldWrap::No, regmatch, match_case);
         if (!range.is_valid())
             break;
         ranges.append(range);

+ 1 - 1
Userland/Libraries/LibGUI/TextDocument.h

@@ -89,7 +89,7 @@ public:
     String text() const;
     String text_in_range(const TextRange&) const;
 
-    Vector<TextRange> find_all(StringView needle, bool regmatch = false);
+    Vector<TextRange> find_all(StringView needle, bool regmatch = false, bool match_case = true);
 
     void update_regex_matches(StringView);
     TextRange find_next(StringView, const TextPosition& start = {}, SearchShouldWrap = SearchShouldWrap::Yes, bool regmatch = false, bool match_case = true);