mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Always unsubscribe when changing buffers
Previously subscribeToBuffer() returned early in certain cases without first unsubscribing to the current buffer.
This commit is contained in:
@@ -21,12 +21,15 @@ class SpellCheckView extends View
|
||||
subscribeToBuffer: ->
|
||||
@destroyViews()
|
||||
@task?.abort()
|
||||
return unless @spellCheckCurrentGrammar()
|
||||
|
||||
@buffer?.off '.spell-check'
|
||||
@buffer = @editor.getBuffer()
|
||||
@buffer.on 'contents-modified.spell-check', => @updateMisspellings()
|
||||
@updateMisspellings()
|
||||
if @buffer?
|
||||
@buffer.off '.spell-check'
|
||||
@buffer = null
|
||||
|
||||
if @spellCheckCurrentGrammar()
|
||||
@buffer = @editor.getBuffer()
|
||||
@buffer.on 'contents-modified.spell-check', => @updateMisspellings()
|
||||
@updateMisspellings()
|
||||
|
||||
spellCheckCurrentGrammar: ->
|
||||
grammar = @editor.getGrammar().scopeName
|
||||
|
||||
Reference in New Issue
Block a user