mirror of
https://github.com/atom/atom.git
synced 2026-02-16 01:25:13 -05:00
Unsubscribe if editor has no session
This commit is contained in:
@@ -18,7 +18,7 @@ class SpellCheckView extends View
|
||||
|
||||
@subscribeToBuffer()
|
||||
|
||||
subscribeToBuffer: ->
|
||||
unsubscribeFromBuffer: ->
|
||||
@destroyViews()
|
||||
@task?.abort()
|
||||
|
||||
@@ -26,6 +26,9 @@ class SpellCheckView extends View
|
||||
@buffer.off '.spell-check'
|
||||
@buffer = null
|
||||
|
||||
subscribeToBuffer: ->
|
||||
@unsubscribeFromBuffer()
|
||||
|
||||
if @spellCheckCurrentGrammar()
|
||||
@buffer = @editor.getBuffer()
|
||||
@buffer.on 'contents-modified.spell-check', => @updateMisspellings()
|
||||
@@ -47,6 +50,10 @@ class SpellCheckView extends View
|
||||
@append(view)
|
||||
|
||||
updateMisspellings: ->
|
||||
unless @editor.activeEditSession?
|
||||
@unsubscribeFromBuffer()
|
||||
return
|
||||
|
||||
@task?.abort()
|
||||
|
||||
callback = (misspellings) =>
|
||||
|
||||
Reference in New Issue
Block a user