From 8f5bc219c07a66c01f351901109d7bac2d602bd9 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Wed, 17 Apr 2013 13:56:08 +1000 Subject: Disallow undo and redo when not collecting undo as it is likely that the document is not in the state at the end of the undo history and performing undo will not be able to return to a previous state. --- src/Document.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Document.cxx b/src/Document.cxx index 56785af78..7eef844ee 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -892,7 +892,7 @@ void * SCI_METHOD Document::ConvertToDocument() { int Document::Undo() { int newPos = -1; CheckReadOnly(); - if (enteredModification == 0) { + if ((enteredModification == 0) && (cb.IsCollectingUndo())) { enteredModification++; if (!cb.IsReadOnly()) { bool startSavePoint = cb.IsSavePoint(); @@ -977,7 +977,7 @@ int Document::Undo() { int Document::Redo() { int newPos = -1; CheckReadOnly(); - if (enteredModification == 0) { + if ((enteredModification == 0) && (cb.IsCollectingUndo())) { enteredModification++; if (!cb.IsReadOnly()) { bool startSavePoint = cb.IsSavePoint(); -- cgit v1.2.3