Skip to content

Commit

Permalink
use specific disposable for commands, fix disable/enable minimap-elem…
Browse files Browse the repository at this point in the history
…ent attach bug
  • Loading branch information
fundon committed Feb 6, 2015
1 parent 63cc37c commit 6e5a18e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,21 @@ class Main
# Internal: Used only at export time.
constructor: ->
@emitter = new Emitter

# Commands Subscriptions
@subscriptionsOfCommands = new CompositeDisposable
@subscriptionsOfCommands.add atom.commands.add 'atom-workspace',
'minimap:toggle': => @toggle()
'minimap:generate-plugin': => @generatePlugin()

# Other Subscriptions
@subscriptions = new CompositeDisposable

# Activates the minimap package.
activate: ->
MinimapElement ?= require './minimap-element'

MinimapElement.registerViewProvider()

@subscriptions.add atom.commands.add 'atom-workspace',
'minimap:toggle': => @toggle()
'minimap:generate-plugin': => @generatePlugin()
# Activates the minimap package.
activate: ->

@toggle() if atom.config.get 'minimap.autoToggle'

Expand Down Expand Up @@ -132,7 +136,7 @@ class Main
@editorsMinimaps?.forEach (value, key) =>
value.destroy()
@editorsMinimaps.delete(key)
@editorsMinimaps = undefined
@subscriptions.dispose()
else
@toggled = true
@initSubscriptions()
Expand Down
1 change: 1 addition & 0 deletions lib/minimap-element.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class MinimapElement extends HTMLElement
attach: ->
return if @attached
@swapMinimapPosition()
@attached = true

attachToLeft: ->
root = @getTextEditorElementRoot()
Expand Down

0 comments on commit 6e5a18e

Please sign in to comment.