CommandPanel escapes characters with a backslash in front of them

This commit is contained in:
Corey Johnson
2012-10-31 16:02:37 -07:00
parent eed474435d
commit 8681898a42
2 changed files with 9 additions and 1 deletions

View File

@@ -407,3 +407,8 @@ describe "CommandPanel", ->
expect(editSession.buffer.getPath()).toBe project.resolve(operation.getPath())
expect(editSession.getSelectedBufferRange()).toEqual operation.getBufferRange()
expect(rootView.focus).toHaveBeenCalled()
describe ".escapedCommand()", ->
it "escapes characters with a backslash in front of them", ->
commandPanel.miniEditor.setText("a\\tb")
expect(commandPanel.escapedCommand()).toBe("a\tb")

View File

@@ -102,7 +102,10 @@ class CommandPanel extends View
@previewList.hide()
super
execute: (command = @miniEditor.getText()) ->
escapedCommand: ->
@miniEditor.getText().replace /\\(.)/, (match, charachter) -> eval("'\\#{charachter}'")
execute: (command=@escapedCommand())->
try
@commandInterpreter.eval(command, @rootView.getActiveEditSession()).done (operationsToPreview) =>
@history.push(command)