]> git.lyx.org Git - features.git/commitdiff
* src/BufferView.C: make accept/reject-all-changes atomic operations (also fixes...
authorMichael Schmitt <michael.schmitt@teststep.org>
Thu, 1 Feb 2007 13:19:05 +0000 (13:19 +0000)
committerMichael Schmitt <michael.schmitt@teststep.org>
Thu, 1 Feb 2007 13:19:05 +0000 (13:19 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17003 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.C

index ff3b47924018f876f07d04a52d8774abce6ac1c8..0490cb2b21a3833f3c0cf100dccccacd1d6a311a 100644 (file)
@@ -878,25 +878,24 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd)
                        showDialog("changes");
                break;
 
-       case LFUN_ALL_CHANGES_ACCEPT: {
+       case LFUN_ALL_CHANGES_ACCEPT:
+               // select complete document
                cursor_.reset(buffer_->inset());
-#ifdef WITH_WARNINGS
-#warning FIXME changes
-#endif
-               while (findNextChange(this))
-                       getLyXText()->acceptOrRejectChanges(cursor_, LyXText::ACCEPT);
+               cursor_.selHandle(true);
+               buffer_->text().cursorBottom(cursor_);
+               // accept everything in a single step to support atomic undo
+               buffer_->text().acceptOrRejectChanges(cursor_, LyXText::ACCEPT);
                break;
-       }
 
-       case LFUN_ALL_CHANGES_REJECT: {
+       case LFUN_ALL_CHANGES_REJECT:
+               // select complete document
                cursor_.reset(buffer_->inset());
-#ifdef WITH_WARNINGS
-#warning FIXME changes
-#endif
-               while (findNextChange(this))
-                       getLyXText()->acceptOrRejectChanges(cursor_, LyXText::REJECT);
+               cursor_.selHandle(true);
+               buffer_->text().cursorBottom(cursor_);
+               // reject everything in a single step to support atomic undo
+               // Note: reject does not work recursively; the user may have to repeat the operation
+               buffer_->text().acceptOrRejectChanges(cursor_, LyXText::REJECT);
                break;
-       }
 
        case LFUN_WORD_FIND:
                find(this, cmd);