The CommandPanel allows \/ inside of regexes

This commit is contained in:
Corey Johnson & Nathan Sobo 2012-11-29 14:33:59 -08:00
parent 00832b08bb
commit 395acaf069
2 changed files with 9 additions and 1 deletions

View File

@ -59,7 +59,7 @@ selectAllMatchesInProject
= 'X' _ 'x' _ '/' pattern:pattern '/'? { return [new SelectAllMatchesInProject(pattern)] }
pattern
= pattern:[^/]* { return pattern.join('') }
= pattern:('\\/' / [^/])* { return pattern.join('') }
integer
= digits:[0-9]+ { return parseInt(digits.join('')); }

View File

@ -172,6 +172,14 @@ describe "CommandInterpreter", ->
runs ->
expect(interpreter.lastRelativeAddress.subcommands[0].regex.toString()).toEqual "/a\\Sray/i"
it "allows the regex to contain an escaped forward slash", ->
buffer.setText "hey/baby"
waitsForPromise ->
interpreter.eval('/y\\/b/', editSession)
runs ->
expect(editSession.getSelectedText()).toBe "y/b"
describe "when no match is found", ->
it "it returns an error messages", ->
errorMessages = null