Skip to content

Commit

Permalink
🐛 Fix broken quick settings button in minimap
Browse files Browse the repository at this point in the history
  • Loading branch information
abe33 committed Dec 2, 2014
1 parent f8b4ae0 commit da1986a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/minimap-open-quick-settings-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ class MinimapOpenQuickSettingsView extends View

@dropdown.css(css).attach()

@dropdown.on 'minimap:quick-settings-destroyed', =>
@dropdown.onDidDestroy =>
@dropdown.off()
@dropdown = null
17 changes: 11 additions & 6 deletions lib/minimap-quick-settings-view.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{View} = require 'atom-space-pen-views'
{CompositeDisposable} = require 'event-kit'
{CompositeDisposable, Emitter} = require 'event-kit'
$ = View.__super__.constructor

Minimap = require './minimap'
Expand All @@ -16,6 +16,7 @@ class MinimapQuickSettingsView extends View
selectedItem: null

initialize: (@minimapView) ->
@emitter = new Emitter
@subscriptions = new CompositeDisposable
@plugins = {}
@subscriptions.add Minimap.onDidAddPlugin ({name, plugin}) =>
Expand All @@ -27,10 +28,11 @@ class MinimapQuickSettingsView extends View
@subscriptions.add Minimap.onDidDeactivatePlugin ({name, plugin}) =>
@deactivateItem(name, plugin)

@on 'core:move-up', @selectPreviousItem
@on 'core:move-down', @selectNextItem
@on 'core:cancel', @destroy
@on 'core:validate', @toggleSelectedItem
@subscriptions.add atom.commands.add this,
'core:move-up': => @selectPreviousItem()
'core:move-down': => @selectNextItem()
'core:cancel': => @destroy()
'core:validate': => @toggleSelectedItem()

@codeHighlights.toggleClass('active', @minimapView.displayCodeHighlights)
@codeHighlights.on 'mousedown', (e) =>
Expand All @@ -42,12 +44,15 @@ class MinimapQuickSettingsView extends View

@initList()

onDidDestroy: (callback) ->
@emitter.on 'did-destroy', callback

attach: ->
atom.workspaceView.append this
@hiddenInput.focus()

destroy: =>
@trigger('minimap:quick-settings-destroyed')
@emitter.emit('did-destroy')
@off()
@hiddenInput.off()
@codeHighlights.off()
Expand Down

0 comments on commit da1986a

Please sign in to comment.