From 6bce9abfee581c5ca03670a5b7f8e50dd911d83e Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 7 Apr 2014 16:46:47 +0200 Subject: [PATCH] Respect group integrity when removing stuff from the Undo stack. Fixes: #9079 --- src/Undo.cpp | 8 ++++++-- status.21x | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Undo.cpp b/src/Undo.cpp index a335873d7c..31eaec3dbd 100644 --- a/src/Undo.cpp +++ b/src/Undo.cpp @@ -160,13 +160,17 @@ public: /// Push an item on to the stack, deleting the bottom group on /// overflow. void push(UndoElement const & v) { - c_.push_front(v); - if (c_.size() > limit_) { + // Remove some entries if the limit has been reached. + // However, if the only group on the stack is the one + // we are currently populating, do nothing. + if (c_.size() >= limit_ + && c_.front().group_id != v.group_id) { // remove a whole group at once. const size_t gid = c_.back().group_id; while (!c_.empty() && c_.back().group_id == gid) c_.pop_back(); } + c_.push_front(v); } /// Mark all the elements of the stack as dirty diff --git a/status.21x b/status.21x index add6a75c58..8e794d384c 100644 --- a/status.21x +++ b/status.21x @@ -80,6 +80,8 @@ What's new - Fix select-by-doubleclick in mathed (bug 8829). +- Fix undo with many individual changes (e.g. with replace all) + (bug #7079). * INTERNALS -- 2.39.5