From 80361eb1eb7013600131c986238bc9264ca2cbd3 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Fri, 27 Dec 2019 14:49:51 +0100 Subject: [PATCH] Do not track changes while accepting/rejecting all changes Fixes #7487 --- src/BufferView.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 0aad452fd0..4495093cf2 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -1551,32 +1551,43 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr) } break; - case LFUN_ALL_CHANGES_ACCEPT: + case LFUN_ALL_CHANGES_ACCEPT: { // select complete document cur.reset(); cur.selHandle(true); buffer_.text().cursorBottom(cur); // accept everything in a single step to support atomic undo + // temporarily disable track changes in order to end with really + // no new (e.g., DPSM-caused) changes (see #7487) + bool const track = buffer_.params().track_changes; + buffer_.params().track_changes = false; buffer_.text().acceptOrRejectChanges(cur, Text::ACCEPT); + buffer_.params().track_changes = track; cur.resetAnchor(); // FIXME: Move this LFUN to Buffer so that we don't have to do this: dr.screenUpdate(Update::Force | Update::FitCursor); dr.forceBufferUpdate(); break; + } - case LFUN_ALL_CHANGES_REJECT: + case LFUN_ALL_CHANGES_REJECT: { // select complete document cur.reset(); cur.selHandle(true); buffer_.text().cursorBottom(cur); // reject everything in a single step to support atomic undo - // Note: reject does not work recursively; the user may have to repeat the operation + // temporarily disable track changes in order to end with really + // no new (e.g., DPSM-caused) changes (see #7487) + bool const track = buffer_.params().track_changes; + buffer_.params().track_changes = false; buffer_.text().acceptOrRejectChanges(cur, Text::REJECT); + buffer_.params().track_changes = track; cur.resetAnchor(); // FIXME: Move this LFUN to Buffer so that we don't have to do this: dr.screenUpdate(Update::Force | Update::FitCursor); dr.forceBufferUpdate(); break; + } case LFUN_WORD_FIND_FORWARD: case LFUN_WORD_FIND_BACKWARD: {