implement meta-f on root-view

This commit is contained in:
Corey Johnson
2012-03-23 10:10:53 -07:00
parent ef9bb5a259
commit ef9eaff054
3 changed files with 23 additions and 10 deletions

View File

@@ -24,15 +24,18 @@ class CommandPanel extends View
@commandInterpreter = new CommandInterpreter()
toggle: ->
if @parent().length
@detach()
@rootView.activeEditor().focus()
else
@rootView.append(this)
@prompt.css 'font', @editor.css('font')
@editor.focus()
@editor.buffer.setText('')
if @parent().length then @hide() else @show()
show: ->
@rootView.append(this)
@prompt.css 'font', @editor.css('font')
@editor.focus()
@editor.buffer.setText('')
hide: ->
@detach()
@rootView.activeEditor().focus()
execute: ->
@commandInterpreter.eval(@rootView.activeEditor(), @editor.getText())
@toggle()
@hide()

View File

@@ -28,9 +28,13 @@ class RootView extends View
'meta-t': 'toggle-file-finder'
'meta-:': 'command-panel:toggle'
'alt-meta-i': 'show-console'
'meta-f': 'find-in-file'
@on 'toggle-file-finder', => @toggleFileFinder()
@on 'show-console', -> window.showConsole()
@on 'find-in-file', =>
@commandPanel.show()
@commandPanel.editor.setText("/")
@one 'attach', => @focus()
@on 'focus', (e) =>