Skip to content

Commit

Permalink
fix toggle, #255
Browse files Browse the repository at this point in the history
  • Loading branch information
fundon committed Feb 6, 2015
1 parent b7d8ec0 commit 63cc37c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ class Main

# Activates the minimap package.
activate: ->
@subscriptions = new CompositeDisposable

This comment has been minimized.

Copy link
@abe33

abe33 Feb 6, 2015

Contributor

Instead of the constructor I believe we should move that line into initSubscriptions so that we recreate one every time the minimap is toggled on

MinimapElement ?= require './minimap-element'

MinimapElement.registerViewProvider()
Expand Down Expand Up @@ -130,7 +129,10 @@ class Main
toggle: ->
if @toggled
@toggled = false
@subscriptions.dispose()

This comment has been minimized.

Copy link
@abe33

abe33 Feb 6, 2015

Contributor

I'm pretty sure this line should be kept, if we don't dispose the subscription we'll continue creating minimaps for each new text editors.

This comment has been minimized.

Copy link
@fundon

fundon Feb 6, 2015

Author Member

But also atom.commands.add and atom.workspace.observeTextEditors will be disposed

This comment has been minimized.

Copy link
@abe33

abe33 Feb 6, 2015

Contributor

True, then we should store this specific disposable in another property so that we can release it individually.

This comment has been minimized.

Copy link
@fundon

fundon Feb 6, 2015

Author Member

@abe33 The source codes of V4 is very clean & beautiful, I love it.

Refactor

@editorsMinimaps?.forEach (value, key) =>
value.destroy()
@editorsMinimaps.delete(key)

This comment has been minimized.

Copy link
@abe33

abe33 Feb 6, 2015

Contributor

I believe this line is not needed, as you nullify the reference after the loop.

@editorsMinimaps = undefined
else
@toggled = true
@initSubscriptions()
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"mixto": "1.x",
"delegato": "1.x",
"semver": "~2.3.0",
"event-kit": "0.7.x",
"event-kit": "1.x",
"fs-plus": "2.x",
"temp": "0.5.0",
"underscore-plus": "1.x",
Expand Down

0 comments on commit 63cc37c

Please sign in to comment.