diff options
author | aycabta <aycabta@gmail.com> | 2019-05-30 18:29:26 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2019-05-30 18:29:26 +0900 |
commit | ecd0f1d966209742382e5bd4591bafc88152a697 (patch) | |
tree | a8a275ed7f497be93b76efe55d45de264afcf98d | |
parent | fcca39fa73607e6acf2aea00fd8bf746023955dc (diff) | |
download | ruby-ecd0f1d966209742382e5bd4591bafc88152a697.tar.gz |
Use negative lookahead and start_with?
-rw-r--r-- | lib/reline/line_editor.rb | 2 |
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 \" |