mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28: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
|
@ -14,15 +14,6 @@ class GMenu;
|
|||
class GScrollBar;
|
||||
class Painter;
|
||||
|
||||
enum class ShouldWrapAtEndOfDocument {
|
||||
No = 0,
|
||||
Yes
|
||||
};
|
||||
enum class ShouldWrapAtStartOfDocument {
|
||||
No = 0,
|
||||
Yes
|
||||
};
|
||||
|
||||
class GTextEditor
|
||||
: public GScrollableWidget
|
||||
, public GTextDocument::Client {
|
||||
|
@ -74,12 +65,6 @@ public:
|
|||
|
||||
bool write_to_file(const StringView& path);
|
||||
|
||||
GTextRange find_next(const StringView&, const GTextPosition& start = {});
|
||||
GTextRange find_prev(const StringView&, const GTextPosition& start = {});
|
||||
|
||||
GTextPosition next_position_after(const GTextPosition&, ShouldWrapAtEndOfDocument = ShouldWrapAtEndOfDocument::Yes);
|
||||
GTextPosition prev_position_before(const GTextPosition&, ShouldWrapAtStartOfDocument = ShouldWrapAtStartOfDocument::Yes);
|
||||
|
||||
bool has_selection() const { return m_selection.is_valid(); }
|
||||
String selected_text() const;
|
||||
void set_selection(const GTextRange&);
|
||||
|
@ -167,7 +152,6 @@ private:
|
|||
void delete_selection();
|
||||
void did_update_selection();
|
||||
int content_x_for_position(const GTextPosition&) const;
|
||||
char character_at(const GTextPosition&) const;
|
||||
Rect ruler_rect_in_inner_coordinates() const;
|
||||
Rect visible_text_rect_in_inner_coordinates() const;
|
||||
void recompute_all_visual_lines();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue