Skip to content

Commit be3a205

Browse files
committed
Making the close method invoke script:close-view
This was the behavior before using `MessagePanelView`
1 parent 42c77e7 commit be3a205

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

lib/script-view.coffee

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,18 @@ class ScriptView extends MessagePanelView
4747
# Get script view ready
4848
@clear()
4949

50-
close: ->
50+
removePanel: ->
5151
@stop()
5252
@detach()
53-
super
53+
# the 'close' method from MessagePanelView actually destroys the panel
54+
ScriptView.__super__.close.apply(this)
55+
56+
# This is triggered when hitting the 'close' button on the panel
57+
# We are not actually closing the panel here since we want to trigger
58+
# 'script:close-view' which will eventually remove the panel via 'removePanel'
59+
close: ->
60+
workspaceView = atom.views.getView(atom.workspace)
61+
atom.commands.dispatch workspaceView, 'script:close-view'
5462

5563
stop: ->
5664
@display 'stdout', '^C'

lib/script.coffee

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ module.exports =
5151

5252
deactivate: ->
5353
@runtime.destroy()
54-
@scriptView.close()
54+
@scriptView.removePanel()
5555
@scriptOptionsView.close()
5656
@subscriptions.dispose()
5757
GrammarUtils.deleteTempFiles()
5858

5959
closeScriptViewAndStopRunner: ->
6060
@runtime.stop()
61-
@scriptView.close()
61+
@scriptView.removePanel()
6262

6363
# Public
6464
#

0 commit comments

Comments
 (0)