LibGUI: Expose a function to clear GTextEditor selection

This commit is contained in:
Sasan Hezarkhani 2019-12-01 18:48:32 -08:00 committed by Andreas Kling
parent 9a01e70ff9
commit 5c2ef01f7b
Notes: sideshowbarker 2024-07-19 10:58:31 +09:00
2 changed files with 9 additions and 0 deletions

View file

@ -1223,6 +1223,14 @@ void GTextEditor::set_selection(const GTextRange& selection)
update();
}
void GTextEditor::clear_selection()
{
if (!has_selection())
return;
m_selection.clear();
update();
}
void GTextEditor::recompute_all_visual_lines()
{
int y_offset = 0;

View file

@ -69,6 +69,7 @@ public:
bool has_selection() const { return m_selection.is_valid(); }
String selected_text() const;
void set_selection(const GTextRange&);
void clear_selection();
bool can_undo() const { return document().can_undo(); }
bool can_redo() const { return document().can_redo(); }