Fix bug where cursor occasionally precedes '/' after pressing meta-f

Now we always move cursor to end when setting the command panel's mini-editor text.
This commit is contained in:
Nathan Sobo
2012-07-20 10:44:49 -06:00
parent b27a793b92
commit 411215f6c8
2 changed files with 6 additions and 1 deletions

View File

@@ -97,10 +97,14 @@ describe "CommandPanel", ->
expect(commandInterpreter.lastRelativeAddress.subcommands[0].regex.toString()).toEqual "/\\(items\\)/"
describe "when command-panel:find-in-file is triggered on an editor", ->
it "pre-populates command panel's editor with /", ->
it "pre-populates command panel's editor with / and moves the cursor to column 1", ->
commandPanel.miniEditor.setText("foo")
commandPanel.miniEditor.setCursorBufferPosition([0, 0])
rootView.getActiveEditor().trigger "command-panel:find-in-file"
expect(commandPanel.parent).not.toBeEmpty()
expect(commandPanel.miniEditor.getText()).toBe "/"
expect(commandPanel.miniEditor.getCursorBufferPosition()).toEqual [0, 1]
describe "when esc is pressed in the command panel", ->
it "closes the command panel", ->

View File

@@ -63,6 +63,7 @@ class CommandPanel extends View
@previewList.hide()
@miniEditor.focus()
@miniEditor.setText(text)
@miniEditor.setCursorBufferPosition([0, Infinity])
detach: ->
@rootView.focus()