]> git.lyx.org Git - features.git/commitdiff
Disable certain change tracking commands when there are no changes
authorGuillaume Munch <gm@lyx.org>
Tue, 3 May 2016 21:15:21 +0000 (22:15 +0100)
committerRichard Heck <rgheck@lyx.org>
Wed, 15 Jun 2016 21:32:53 +0000 (22:32 +0100)
Fix TODO

src/BufferView.cpp
src/Changes.cpp

index 9c19cae800264ae59f1c06fa0c4f5d8931cf1184..a158393579f74558e6b74cc9ee8b3c8cd64b3ca2 100644 (file)
@@ -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:
index 1b1bceefed414c2fa2b556480ad091c94f936c72..88ecaf256dc2776dcc6a90c029713bbaf9173eca 100644 (file)
@@ -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);