mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Regex's in the command panel are treated as case-insensitive if there are no non-escaped letters in the pattern
/hello becomes /hello/i /he\Slo becomes /he\Slo/i /Hello/i becomes /Hello/i /Hello/ becomes /Hello/
This commit is contained in:
@@ -161,6 +161,22 @@ describe "CommandInterpreter", ->
|
||||
expect(editSession.lineForScreenRow(5).fold).toBeUndefined()
|
||||
expect(editSession.lineForScreenRow(10).fold).toBeDefined()
|
||||
|
||||
it "is case-insentive when the pattern contains no non-escaped uppercase letters (behavior copied from vim)", ->
|
||||
waitsForPromise ->
|
||||
editSession.setSelectedBufferRange([[4,16], [4,20]])
|
||||
interpreter.eval('/array', editSession)
|
||||
|
||||
runs ->
|
||||
expect(editSession.getSelection().getBufferRange()).toEqual [[11,14], [11,19]]
|
||||
|
||||
waitsForPromise ->
|
||||
editSession.setSelectedBufferRange([[4,16], [4,20]])
|
||||
interpreter.eval('/a\\Sray', editSession) # You must escape the backslash, otherwise it is treated as an escaped 'S'
|
||||
|
||||
runs ->
|
||||
expect(editSession.getSelection().getBufferRange()).toEqual [[11,14], [11,19]]
|
||||
|
||||
|
||||
describe "address range", ->
|
||||
describe "when two addresses are specified", ->
|
||||
it "selects from the begining of the left address to the end of the right address", ->
|
||||
|
||||
@@ -241,7 +241,7 @@ describe "CommandPanel", ->
|
||||
expect(commandInterpreter.lastRelativeAddress).toBeUndefined()
|
||||
rootView.trigger 'command-panel:set-selection-as-regex-address'
|
||||
expect(commandInterpreter.lastRelativeAddress.subcommands.length).toBe 1
|
||||
expect(commandInterpreter.lastRelativeAddress.subcommands[0].regex.toString()).toEqual "/\\(items\\)/"
|
||||
expect(commandInterpreter.lastRelativeAddress.subcommands[0].regex.toString()).toEqual "/\\(items\\)/i"
|
||||
|
||||
describe "when command-panel:find-in-file is triggered on an editor", ->
|
||||
it "pre-populates the command panel's editor with / and moves the cursor to the last column", ->
|
||||
|
||||
Reference in New Issue
Block a user