prevent spell check from running twice on doc load

This commit is contained in:
Henry Oswald 2014-11-04 14:20:59 +00:00
parent 908926a0cc
commit a2f99bc04f

View file

@ -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