diff --git a/lib/minimap-view.coffee b/lib/minimap-view.coffee index 9a9a3249..c6e471bb 100644 --- a/lib/minimap-view.coffee +++ b/lib/minimap-view.coffee @@ -75,7 +75,7 @@ class MinimapView extends View # Creates a new {MinimapView}. # # editorView - The `TextEditorView` for which displaying a minimap. - constructor: (editorView) -> + constructor: (editorView, @paneView) -> @emitter = new Emitter @setEditorView(editorView) @@ -213,8 +213,12 @@ class MinimapView extends View setEditorView: (@editorView) -> @editor = @editorView.getModel() - @pane = atom.workspace.paneForItem(@editor) - @paneView = atom.views.getView(@pane) + if @paneView? + @pane = @paneView.getModel() + else + @pane = atom.workspace.paneForItem(@editor) + @paneView = atom.views.getView(@pane) + @renderView?.setEditorView(@editorView) if @obsPane? diff --git a/lib/mixins/view-management.coffee b/lib/mixins/view-management.coffee index 5c2cda90..0eb6910d 100644 --- a/lib/mixins/view-management.coffee +++ b/lib/mixins/view-management.coffee @@ -87,22 +87,22 @@ class ViewManagement extends Mixin @updateAllViews() onEditorAdded: (editor, pane) -> - editorView = atom.views.getView(editor) - MinimapView ||= require '../minimap-view' editorId = editor.id + editorView = atom.views.getView(editor) paneView = atom.views.getView(pane) - return unless paneView? + return unless editorView? and paneView? if (view = @minimapViews[editorId])? + view.paneView = paneView view.setEditorView editorView view.detachFromPaneView() view.attachToPaneView() return - view = new MinimapView(editorView) + view = new MinimapView(editorView, paneView) @minimapViews[editorId] = view