Meta-shift-f opens the command panel pre-populated with Xx/ to find in project

This commit is contained in:
Nathan Sobo 2012-07-20 13:57:33 -06:00
parent 73654a5e3f
commit d16328c533
3 changed files with 14 additions and 0 deletions

View File

@ -108,6 +108,18 @@ describe "CommandPanel", ->
expect(commandPanel.miniEditor.getText()).toBe "/"
expect(commandPanel.miniEditor.getCursorBufferPosition()).toEqual [0, 1]
describe "when command-panel:find-in-project is triggered on the root view", ->
it "pre-populates the command panel's editor with Xx/ and moves the cursor to the last column", ->
spyOn(commandPanel, 'attach').andCallThrough()
commandPanel.miniEditor.setText("foo")
commandPanel.miniEditor.setCursorBufferPosition([0, 0])
rootView.trigger "command-panel:find-in-project"
expect(commandPanel.attach).toHaveBeenCalled()
expect(commandPanel.parent).not.toBeEmpty()
expect(commandPanel.miniEditor.getText()).toBe "Xx/"
expect(commandPanel.miniEditor.getCursorBufferPosition()).toEqual [0, 3]
describe "when esc is pressed in the command panel", ->
it "closes the command panel", ->
rootView.trigger 'command-panel:toggle'

View File

@ -47,6 +47,7 @@ class CommandPanel extends View
@rootView.on 'command-panel:toggle', => @toggle()
@rootView.on 'command-panel:execute', => @execute()
@rootView.on 'command-panel:find-in-file', => @attach("/")
@rootView.on 'command-panel:find-in-project', => @attach("Xx/")
@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()

View File

@ -10,3 +10,4 @@ window.keymap.bindKeys '.editor',
'meta-G': 'command-panel:repeat-relative-address-in-reverse'
'meta-e': 'command-panel:set-selection-as-regex-address'
'meta-f': 'command-panel:find-in-file'
'meta-F': 'command-panel:find-in-project'