Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #71 from atom/as-dont-watch-same-editor
Browse files Browse the repository at this point in the history
Don't watch editors more than once if they're re-added to the workspace
  • Loading branch information
Antonio Scandurra committed Nov 28, 2017
2 parents 95ec094 + 49590f2 commit 2f13396
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/main.coffee
Expand Up @@ -2,6 +2,13 @@ WrapGuideElement = require './wrap-guide-element'

module.exports =
activate: ->
watchedEditors = new WeakSet()

atom.workspace.observeTextEditors (editor) ->
return if watchedEditors.has(editor)

editorElement = atom.views.getView(editor)
wrapGuideElement = new WrapGuideElement(editor, editorElement)

watchedEditors.add(editor)
editor.onDidDestroy -> watchedEditors.delete(editor)

0 comments on commit 2f13396

Please sign in to comment.