From 31fd5512643a8d9068067d2bda5015cbc597d0f9 Mon Sep 17 00:00:00 2001 From: tophf Date: Mon, 18 Dec 2017 09:56:34 +0300 Subject: [PATCH] trivial speed-ups for the single editor case --- edit/sections.js | 3 +++ edit/source-editor.js | 2 ++ 2 files changed, 5 insertions(+) diff --git a/edit/sections.js b/edit/sections.js index 5e6f8715..c5380303 100644 --- a/edit/sections.js +++ b/edit/sections.js @@ -455,6 +455,9 @@ function removeAreaAndSetDirty(area) { } function makeSectionVisible(cm) { + if (editors.length === 1) { + return; + } const section = cm.getSection(); const bounds = section.getBoundingClientRect(); if ( diff --git a/edit/source-editor.js b/edit/source-editor.js index f9139be1..4be93c9e 100644 --- a/edit/source-editor.js +++ b/edit/source-editor.js @@ -146,6 +146,8 @@ function createSourceEditor(style) { CodeMirror.commands.nextEditor = cm => nextPrevMozDocument(cm, 1); CodeMirror.commands.toggleStyle = toggleStyle; CodeMirror.commands.save = save; + + CodeMirror.closestVisible = () => cm; } function updateMeta() {