diff options
| author | Matthias Melcher <github@matthiasm.com> | 2023-04-14 16:32:23 +0200 |
|---|---|---|
| committer | Matthias Melcher <github@matthiasm.com> | 2023-04-14 16:32:36 +0200 |
| commit | afd3fde5de41cd5c10e0953e25976912cf4cf25f (patch) | |
| tree | 50fd26c622e4a3a0798a308c972e9118cb9409df /src | |
| parent | 7e2defc10d3816eaab14369941a84b68c8d1d2bc (diff) | |
Memory leak in Input_ #716
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Input_.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx index 7842c9fca..16b2f4aae 100644 --- a/src/Fl_Input_.cxx +++ b/src/Fl_Input_.cxx @@ -88,6 +88,10 @@ public: clear(); } + int size() const { + return list_size_; + } + void push(Fl_Input_Undo_Action* action) { if (list_size_ == list_capacity_) { list_capacity_ += 25; @@ -1067,6 +1071,15 @@ int Fl_Input_::undo() { } /** + Check if the last operation can be undone. + + \return true if the widget can unod the last change + */ +bool Fl_Input_::can_undo() { + return (undo_->undocut || undo_->undoinsert); +} + +/** Redo previous undo operation. This call reapplies previously executed undo operations. @@ -1080,6 +1093,8 @@ int Fl_Input_::redo() { if (undo_->undocut || undo_->undoinsert) undo_list_->push(undo_); + else + delete undo_; undo_ = redo_action; int ret = apply_undo(); @@ -1089,6 +1104,15 @@ int Fl_Input_::redo() { } /** + Check if there is a redo action available. + + \return true if the widget can redo the last undo action + */ +bool Fl_Input_::can_redo() { + return (redo_list_->size() > 0); +} + +/** Copies the \e yank buffer to the clipboard. This method copies all the previous contiguous cuts from the undo |
