From 5ffb6cfbe2674412d7064b8ca36e82cb03a8a28f Mon Sep 17 00:00:00 2001 From: Michael Schmitt Date: Thu, 1 Feb 2007 13:19:05 +0000 Subject: [PATCH] * src/BufferView.C: make accept/reject-all-changes atomic operations (also fixes a crash) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17003 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.C | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/BufferView.C b/src/BufferView.C index ff3b479240..0490cb2b21 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -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);