From 385cabf3aac721d6a4c1f499f9fc4955c4c805f9 Mon Sep 17 00:00:00 2001 From: ZJUGKC Date: Mon, 17 Apr 2023 22:12:03 +0800 Subject: Add const qualifiers to can_undo and can_redo (#720) --- src/Fl_Input_.cxx | 4 ++-- src/Fl_Text_Buffer.cxx | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx index 16b2f4aae..eb8f38bfb 100644 --- a/src/Fl_Input_.cxx +++ b/src/Fl_Input_.cxx @@ -1075,7 +1075,7 @@ int Fl_Input_::undo() { \return true if the widget can unod the last change */ -bool Fl_Input_::can_undo() { +bool Fl_Input_::can_undo() const { return (undo_->undocut || undo_->undoinsert); } @@ -1108,7 +1108,7 @@ int Fl_Input_::redo() { \return true if the widget can redo the last undo action */ -bool Fl_Input_::can_redo() { +bool Fl_Input_::can_redo() const { return (redo_list_->size() > 0); } diff --git a/src/Fl_Text_Buffer.cxx b/src/Fl_Text_Buffer.cxx index 2cfe6f1e3..1cfcd1b9b 100644 --- a/src/Fl_Text_Buffer.cxx +++ b/src/Fl_Text_Buffer.cxx @@ -120,7 +120,7 @@ public: undocut = undoinsert = 0; } - bool empty() { + bool empty() const { return (!undocut && !undoinsert); } }; @@ -158,7 +158,7 @@ public: clear(); } - int size() { + int size() const { return list_size_; } @@ -635,7 +635,7 @@ int Fl_Text_Buffer::undo(int *cursorPos) { /* Check if undo is anabled and if the last action can be undone. */ -bool Fl_Text_Buffer::can_undo() { +bool Fl_Text_Buffer::can_undo() const { return (mCanUndo && mUndo && !mUndo->empty()); } @@ -663,7 +663,7 @@ int Fl_Text_Buffer::redo(int *cursorPos) { Check if undo is anabled and if the last undo action can be redone. \see canUndo() */ -bool Fl_Text_Buffer::can_redo() { +bool Fl_Text_Buffer::can_redo() const { return (mCanUndo && mRedoList->size()); } -- cgit v1.2.3