From 3efcc50a0d37ff62e5ce284b5a9a7bab207c9957 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 25 Jun 2012 11:51:04 -0700 Subject: [PATCH] Renamed call to ControlPanel.hide to ControlPanel.detach --- spec/extensions/command-panel-spec.coffee | 1 + src/extensions/command-panel.coffee | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/spec/extensions/command-panel-spec.coffee b/spec/extensions/command-panel-spec.coffee index 6127f5e18..3ff833ec1 100644 --- a/spec/extensions/command-panel-spec.coffee +++ b/spec/extensions/command-panel-spec.coffee @@ -29,6 +29,7 @@ describe "CommandPanel", -> expect(commandPanel.miniEditor.isFocused).toBeFalsy() rootView.trigger 'command-panel:toggle' + window.advanceClock() # Setting the font is in a defer statement expect(rootView.find('.command-panel').view()).toBe commandPanel expect(commandPanel.miniEditor.isFocused).toBeTruthy() # this is currently assigned dynamically since our css scheme lacks variables diff --git a/src/extensions/command-panel.coffee b/src/extensions/command-panel.coffee index cb0fb1e16..579ad810f 100644 --- a/src/extensions/command-panel.coffee +++ b/src/extensions/command-panel.coffee @@ -22,7 +22,7 @@ class CommandPanel extends View @deserialize: (state, rootView) -> commandPanel = new CommandPanel(rootView) - commandPanel.show(state.text) if state.visible + commandPanel.attach(state.text) if state.visible commandPanel @content: -> @@ -40,7 +40,7 @@ class CommandPanel extends View @rootView.on 'command-panel:toggle', => @toggle() @rootView.on 'command-panel:execute', => @execute() - @rootView.on 'command-panel:find-in-file', => @show("/") + @rootView.on 'command-panel:find-in-file', => @attach("/") @rootView.on 'command-panel:repeat-relative-address', => @repeatRelativeAddress() @rootView.on 'command-panel:repeat-relative-address-in-reverse', => @repeatRelativeAddressInReverse() @rootView.on 'command-panel:set-selection-as-regex-address', => @setSelectionAsLastRelativeAddress() @@ -50,17 +50,17 @@ class CommandPanel extends View @miniEditor.on 'move-down', => @navigateForwardInHistory() toggle: -> - if @parent().length then @hide() else @show() + if @parent().length then @detach() else @attach() - show: (text='') -> + attach: (text='') -> @rootView.append(this) - @prompt.css 'font', @miniEditor.css('font') @miniEditor.focus() @miniEditor.buffer.setText(text) + @prompt.css 'font', @miniEditor.css('font') - hide: -> - @detach() - @rootView.activeEditor().focus() + detach: -> + @rootView.focus() + super execute: (command = @miniEditor.getText()) -> try @@ -74,7 +74,7 @@ class CommandPanel extends View @history.push(command) @historyIndex = @history.length - @hide() + @detach() navigateBackwardInHistory: -> return if @historyIndex == 0