Renamed call to ControlPanel.hide to ControlPanel.detach

This commit is contained in:
Corey Johnson
2012-06-25 11:51:04 -07:00
parent 6d69ec77f1
commit 3efcc50a0d
2 changed files with 10 additions and 9 deletions

View File

@@ -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

View File

@@ -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