1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Use negative lookahead and start_with?

This commit is contained in:
aycabta 2019-05-30 18:29:26 +09:00
parent fcca39fa73
commit ecd0f1d966

View file

@ -763,7 +763,7 @@ class Reline::LineEditor
i = 0
while i < @byte_pointer do
slice = @line.byteslice(i, @byte_pointer - i)
if quote and slice =~ /\A(?<!\\)#{Regexp.escape(quote)}/ # closing "
if quote and slice.start_with?(/(?!\\)#{Regexp.escape(quote)}/) # closing "
quote = nil
i += 1
elsif quote and slice =~ /\A\\#{Regexp.escape(quote)}/ # escaped \"