diff options
| author | ZJUGKC <yxxinyuan@zju.edu.cn> | 2023-04-17 22:12:03 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-17 16:12:03 +0200 |
| commit | 385cabf3aac721d6a4c1f499f9fc4955c4c805f9 (patch) | |
| tree | f3a2fd8affc9887ef2d6549eb9add7e8bab4f687 /src | |
| parent | 54ef53d4ae90760ecf2faf457d35b737e51eb13f (diff) | |
Add const qualifiers to can_undo and can_redo (#720)
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Input_.cxx | 4 | ||||
| -rw-r--r-- | src/Fl_Text_Buffer.cxx | 8 |
2 files changed, 6 insertions, 6 deletions
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()); } |
