1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:08:12 +00:00

TextEditor: Implement replacement functionality

This patch adds a new replace widget that cooperates with the find
widget, the replace widget takes the input in the find textbox, searches
for occurences of that input, and replaces them with the input provied
in the replace textbox.
This commit is contained in:
0xtechnobabble 2020-01-11 20:52:47 +02:00 committed by Andreas Kling
parent 2b20e8e187
commit ecf58ddd4f
3 changed files with 131 additions and 13 deletions

View file

@ -64,8 +64,9 @@ public:
// FIXME: This should take glyph spacing into account, no?
int glyph_width() const { return font().glyph_width('x'); }
bool write_to_file(const StringView& path);
void insert_at_cursor_or_replace_selection(const StringView&);
bool write_to_file(const StringView& path);
bool has_selection() const { return m_selection.is_valid(); }
String selected_text() const;
void set_selection(const GTextRange&);
@ -156,7 +157,6 @@ private:
int ruler_width() const;
Rect ruler_content_rect(size_t line) const;
void toggle_selection_if_needed_for_event(const GKeyEvent&);
void insert_at_cursor_or_replace_selection(const StringView&);
void delete_selection();
void did_update_selection();
int content_x_for_position(const GTextPosition&) const;