]> git.lyx.org Git - features.git/commitdiff
Respect group integrity when removing stuff from the Undo stack.
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 7 Apr 2014 14:46:47 +0000 (16:46 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sun, 20 Apr 2014 20:54:31 +0000 (22:54 +0200)
Fixes: #9079
src/Undo.cpp
status.21x

index a335873d7cced6173849d818f02536ef152d34b1..31eaec3dbd84977ee7d52e3dca4c86b3726df7f9 100644 (file)
@@ -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
index add6a75c58a29708e7afaa658c2fa28ced09de3e..8e794d384c08883b4d9dfcc08d255f6d5e653c78 100644 (file)
@@ -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