From a2f99bc04fd5d21063d63dd33852205ec93b0674 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 4 Nov 2014 14:20:59 +0000 Subject: [PATCH] prevent spell check from running twice on doc load --- .../aceEditor/spell-check/SpellCheckManager.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/SpellCheckManager.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/SpellCheckManager.coffee index 9853ac2eca..8b73ce6df9 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/SpellCheckManager.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/SpellCheckManager.coffee @@ -19,7 +19,7 @@ define [ @runCheckOnChange(e) @editor.on "changeSession", (e) => - @runFullCheck() + @runSpellCheckSoon(200) e.oldSession?.getDocument().off "change", onChange e.session.getDocument().on "change", onChange @@ -100,14 +100,14 @@ define [ end: cursor return highlight - runSpellCheckSoon: () -> + runSpellCheckSoon: (delay = 1000) -> run = () => delete @timeoutId @runSpellCheck(@updatedLines) @updatedLines = [] if @timeoutId? clearTimeout @timeoutId - @timeoutId = setTimeout run, 1000 + @timeoutId = setTimeout run, delay markLinesAsUpdated: (change) -> start = change.range.start