From 3c18b31a7fe7f55e86e3c3c647c3b651333c150a Mon Sep 17 00:00:00 2001 From: mpv Date: Tue, 17 Feb 2015 14:35:38 +0300 Subject: [PATCH] Issue #408 : don't allow undo during the operation if there is nothing to undo behind this operation --- src/Model/Model_Document.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index fe4a17309..b6221cc4c 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -419,8 +419,11 @@ bool Model_Document::isModified() bool Model_Document::canUndo() { - if (myDoc->GetAvailableUndos() > 0 && (myNestedNum.empty() || *myNestedNum.rbegin() != 0) && - !myTransactions.empty() /* for omitting the first useless transaction */) + // issue 406 : if transaction is opened, but nothing to undo behind, can not undo + int aCurrentNum = isOperation() ? 1 : 0; + if (myDoc->GetAvailableUndos() > 0 && + (myNestedNum.empty() || *myNestedNum.rbegin() - aCurrentNum > 0) && // there is something to undo in nested + myTransactions.size() - aCurrentNum > 0 /* for omitting the first useless transaction */) return true; // check other subs contains operation that can be undoed const std::set aSubs = subDocuments(true); -- 2.39.2