File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed
Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ class MinimapGitDiffBinding
1313 @subscriptions = new CompositeDisposable
1414
1515 @subscriptions .add @editor .getBuffer ().onDidStopChanging @updateDiffs
16+ @subscriptions .add @minimap .onDidDestroy @destroy
1617
1718 if repository = @ getRepo ()
1819 @subscriptions .add repository .onDidChangeStatuses =>
@@ -59,10 +60,11 @@ class MinimapGitDiffBinding
5960 @markers ?= []
6061 @markers .push (marker)
6162
62- destroy : - >
63+ destroy : = >
6364 @ removeDecorations ()
6465 @subscriptions .dispose ()
6566 @diffs = null
67+ @minimap = null
6668
6769 getPath : -> @editor .getBuffer ()? .getPath ()
6870
Original file line number Diff line number Diff line change @@ -4,21 +4,20 @@ MinimapGitDiffBinding = null
44
55class MinimapGitDiff
66
7- bindings : {}
87 pluginActive : false
98 constructor : ->
109 @subscriptions = new CompositeDisposable
1110
1211 isActive : -> @pluginActive
1312
1413 activate : ->
14+ @bindings = new WeakMap
1515
1616 consumeMinimapServiceV1 : (@minimap ) ->
1717 @minimap .registerPlugin ' git-diff' , this
1818
1919 deactivate : ->
20- binding .destroy () for id,binding of @bindings
21- @bindings = {}
20+ @ destroyBindings ()
2221 @gitDiff = null
2322 @minimap = null
2423
@@ -60,14 +59,15 @@ class MinimapGitDiff
6059
6160 return unless editor?
6261
63- id = editor .id
6462 binding = new MinimapGitDiffBinding @gitDiff , minimap
65- @bindings [id] = binding
63+ @bindings . set (minimap, binding)
6664
6765 getRepositories : -> atom .project .getRepositories ().filter (repo) -> repo?
6866
6967 destroyBindings : =>
70- binding .destroy () for id,binding of @bindings
71- @bindings = {}
68+ return unless @minimap ?
69+ for minimap in @minimap .editorsMinimaps
70+ @bindings .get (minimap)? .destroy ()
71+ @bindings .delete (minimap)
7272
7373module .exports = new MinimapGitDiff
You can’t perform that action at this time.
0 commit comments