From: mpv Date: Tue, 17 Feb 2015 11:35:38 +0000 (+0300) Subject: Issue #408 : don't allow undo during the operation if there is nothing to undo behind... X-Git-Tag: V_1.1.0~176^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3c18b31a7fe7f55e86e3c3c647c3b651333c150a;p=modules%2Fshaper.git Issue #408 : don't allow undo during the operation if there is nothing to undo behind this operation --- 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);