mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
LibGUI: Move text search functions from GTextEditor to GTextDocument
Also add a find_all() that retuns a Vector<GTextRange> and simply does a find_next() loop, returning all the matching ranges.
This commit is contained in:
parent
b81f6f2c43
commit
b8bf998b61
5 changed files with 132 additions and 118 deletions
|
@ -20,6 +20,11 @@ struct GTextDocumentSpan {
|
|||
|
||||
class GTextDocument : public RefCounted<GTextDocument> {
|
||||
public:
|
||||
enum class SearchShouldWrap {
|
||||
No = 0,
|
||||
Yes
|
||||
};
|
||||
|
||||
class Client {
|
||||
public:
|
||||
virtual ~Client();
|
||||
|
@ -61,6 +66,16 @@ public:
|
|||
|
||||
String text_in_range(const GTextRange&) const;
|
||||
|
||||
Vector<GTextRange> find_all(const StringView& needle) const;
|
||||
|
||||
GTextRange find_next(const StringView&, const GTextPosition& start = {}, SearchShouldWrap = SearchShouldWrap::Yes) const;
|
||||
GTextRange find_previous(const StringView&, const GTextPosition& start = {}, SearchShouldWrap = SearchShouldWrap::Yes) const;
|
||||
|
||||
GTextPosition next_position_after(const GTextPosition&, SearchShouldWrap = SearchShouldWrap::Yes) const;
|
||||
GTextPosition previous_position_before(const GTextPosition&, SearchShouldWrap = SearchShouldWrap::Yes) const;
|
||||
|
||||
char character_at(const GTextPosition&) const;
|
||||
|
||||
private:
|
||||
explicit GTextDocument(Client* client);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue