From 05e38d1366e9b39c45dc81d28d930ecbd90e5d82 Mon Sep 17 00:00:00 2001 From: Guillaume Munch Date: Tue, 3 May 2016 22:15:21 +0100 Subject: [PATCH] Disable certain change tracking commands when there are no changes Fix TODO --- src/BufferView.cpp | 6 +----- src/Changes.cpp | 2 ++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 9c19cae800..a158393579 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -1130,11 +1130,7 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag) case LFUN_CHANGE_PREVIOUS: case LFUN_ALL_CHANGES_ACCEPT: case LFUN_ALL_CHANGES_REJECT: - // TODO: context-sensitive enabling of LFUNs - // In principle, these command should only be enabled if there - // is a change in the document. However, without proper - // optimizations, this will inevitably result in poor performance. - flag.setEnabled(true); + flag.setEnabled(buffer_.areChangesPresent()); break; case LFUN_SCREEN_UP: diff --git a/src/Changes.cpp b/src/Changes.cpp index 1b1bceefed..88ecaf256d 100644 --- a/src/Changes.cpp +++ b/src/Changes.cpp @@ -138,6 +138,8 @@ void Changes::set(Change const & change, pos_type const start, pos_type const en << ", author: " << change.author << ", time: " << long(change.changetime) << ") in range (" << start << ", " << end << ")"); + if (!isChanged()) + is_update_required_ = true; } Range const newRange(start, end);