Fix revision viewer might not update after data init, try to use editor operation queue to enhance updateView performance

This commit is contained in:
Wu Cheng-Han 2016-09-18 17:04:33 +08:00
parent a9d7d7438f
commit 93ec43c3dc
1 changed files with 5 additions and 2 deletions

View File

@ -138,7 +138,7 @@ function wrapTextWith(cm, symbol) {
} }
var idleTime = 300000; //5 mins var idleTime = 300000; //5 mins
var updateViewDebounce = 200; var updateViewDebounce = 100;
var cursorMenuThrottle = 50; var cursorMenuThrottle = 50;
var cursorActivityDebounce = 50; var cursorActivityDebounce = 50;
var cursorAnimatePeriod = 100; var cursorAnimatePeriod = 100;
@ -1761,6 +1761,7 @@ function initRevisionViewer() {
}); });
revisionInsertAnnotation = revisionViewer.annotateScrollbar({ className:"CodeMirror-insert-match" }); revisionInsertAnnotation = revisionViewer.annotateScrollbar({ className:"CodeMirror-insert-match" });
revisionDeleteAnnotation = revisionViewer.annotateScrollbar({ className:"CodeMirror-delete-match" }); revisionDeleteAnnotation = revisionViewer.annotateScrollbar({ className:"CodeMirror-delete-match" });
checkRevisionViewer();
} }
$('#revisionModalDownload').click(function () { $('#revisionModalDownload').click(function () {
if (!revision) return; if (!revision) return;
@ -3248,7 +3249,9 @@ function refreshView() {
updateViewInner(); updateViewInner();
} }
var updateView = _.debounce(updateViewInner, updateViewDebounce); var updateView = _.debounce(function () {
editor.operation(updateViewInner);
}, updateViewDebounce);
var lastResult = null; var lastResult = null;
var postUpdateEvent = null; var postUpdateEvent = null;