unbind 'display' listeners on first run

This commit is contained in:
tophf 2017-12-24 14:28:25 +03:00
parent 306b21b75e
commit a53fb162a8

View File

@ -65,9 +65,7 @@
const textHeight = cm.display.cachedTextHeight; const textHeight = cm.display.cachedTextHeight;
const height = cm.display.lastWrapHeight; const height = cm.display.lastWrapHeight;
if (!height || !textHeight) return; if (!height || !textHeight) return;
const numLines = Math.ceil(height / textHeight); maxRenderChunkSize = Math.max(20, Math.ceil(height / textHeight));
if (numLines >= maxRenderChunkSize) return;
maxRenderChunkSize = numLines;
cm.off('update', CM_EVENTS.update); cm.off('update', CM_EVENTS.update);
}, },
mousedown(cm, event) { mousedown(cm, event) {