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

TextEditor: Enable/disable undo & redo buttons based on availability (#740)

This commit is contained in:
Rhin 2019-11-09 01:50:39 -06:00 committed by Andreas Kling
parent 3e84ea9a53
commit 503fe37eaa
2 changed files with 10 additions and 2 deletions

View file

@ -69,6 +69,8 @@ public:
bool has_selection() const { return m_selection.is_valid(); }
String selected_text() const;
void set_selection(const GTextRange&);
bool can_undo() const { return m_undo_stack_index < m_undo_stack.size() && !m_undo_stack.is_empty(); }
bool can_redo() const { return m_undo_stack_index > 0 && m_undo_stack[m_undo_stack_index - 1].m_undo_vector.size() > 0 && !m_undo_stack.is_empty(); }
String text() const;