mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2025-01-08 16:19:17 +03:00
Regex searches are case-sensitive if any letter is capitalized.
Fixes bug introduced in commit aa3f674948
This commit is contained in:
parent
dd81e69bfb
commit
8328875021
@ -163,19 +163,25 @@ describe "CommandInterpreter", ->
|
||||
|
||||
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]]
|
||||
expect(interpreter.lastRelativeAddress.subcommands[0].regex.toString()).toEqual "/array/i"
|
||||
|
||||
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'
|
||||
|
||||
interpreter.eval('/a\\Sray', editSession)
|
||||
runs ->
|
||||
expect(editSession.getSelection().getBufferRange()).toEqual [[11,14], [11,19]]
|
||||
expect(interpreter.lastRelativeAddress.subcommands[0].regex.toString()).toEqual "/a\\Sray/i"
|
||||
|
||||
it "is case-sentive when the pattern contains a non-escaped uppercase letters (behavior copied from vim)", ->
|
||||
waitsForPromise ->
|
||||
interpreter.eval('/arRay', editSession)
|
||||
runs ->
|
||||
expect(interpreter.lastRelativeAddress.subcommands[0].regex.toString()).toEqual "/arRay/"
|
||||
|
||||
waitsForPromise ->
|
||||
interpreter.eval('/Array', editSession)
|
||||
runs ->
|
||||
expect(interpreter.lastRelativeAddress.subcommands[0].regex.toString()).toEqual "/Array/"
|
||||
|
||||
describe "address range", ->
|
||||
describe "when two addresses are specified", ->
|
||||
|
@ -10,7 +10,7 @@ class RegexAddress extends Address
|
||||
flags = ""
|
||||
pattern = pattern.source if pattern.source
|
||||
|
||||
patternContainsCapitalLetter = /[^\\][A-Z]/.test(pattern)
|
||||
patternContainsCapitalLetter = /(^|[^\\])[A-Z]/.test(pattern)
|
||||
flags += "i" unless patternContainsCapitalLetter
|
||||
@isReversed = isReversed
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user