def reassign(self, view):
        v = view.settings()
        v.clear_on_change("checkbounce_spelling_monitor")
        on = v.get("enable_checkbounce_spelling")
        vid = view.id()

        if not vid in self.prev_syntax:
            self.prev_syntax[vid] = v.get("syntax")
        elif self.prev_syntax[vid] != v.get("syntax"):
            SpellChecker.remove(view.id())
            view.erase_status('checkbounce')
            SpellChecker.assign(view, self.finish)

        if on != self.on:
            self.on = on
            SpellChecker.remove(vid)
            sublime.set_timeout(lambda: view.erase_status('checkbounce'), 0)

            if on:
                SpellChecker.assign(view, self.finish)
                SpellChecker.reload()
            if not on:
                if vid in self.loaded:
                    self.loaded.remove(vid)
                if vid in self.checked:
                    self.checked.remove(vid)

            self.on_modified(view)

        v.add_on_change('checkbounce_spelling_monitor', lambda: self.reassign(view))
    def on_new(self, view):
        vid = view.id()
        self.loaded.add(vid)
        v = view.settings()
        if not v.has("enable_checkbounce_spelling"):
            default = sublime.load_settings("CheckBounce.sublime-settings").get("check_spelling", True)
            v.set("enable_checkbounce_spelling", default)

        v.add_on_change('checkbounce_spelling_monitor', lambda: self.reassign(view))
        SpellChecker.assign(view, self.finish)
 def check_spelling(self, view, check=False):
     if check and SpellChecker.assign(view, self.finish) != None:
         self.hit(view)