aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-05-30 18:29:26 +0900
committeraycabta <aycabta@gmail.com>2019-05-30 18:29:26 +0900
commitecd0f1d966209742382e5bd4591bafc88152a697 (patch)
treea8a275ed7f497be93b76efe55d45de264afcf98d
parentfcca39fa73607e6acf2aea00fd8bf746023955dc (diff)
downloadruby-ecd0f1d966209742382e5bd4591bafc88152a697.tar.gz
Use negative lookahead and start_with?
-rw-r--r--lib/reline/line_editor.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 805053fbff..af23367063 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -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 \"