diff options
author | aycabta <aycabta@gmail.com> | 2019-07-25 17:19:11 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2019-07-25 17:19:16 +0900 |
commit | 0f9ec4a877496278534e5956b640ed43a02229ad (patch) | |
tree | 8a8f585ddfff66921a72a0486baff3479482e21a | |
parent | 8e53d18e6724211bd0597ec5852869e6bf9679f1 (diff) | |
download | ruby-0f9ec4a877496278534e5956b640ed43a02229ad.tar.gz |
Check wether multibyte character is split
-rw-r--r-- | lib/reline/line_editor.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index a238e4954c..e9e693eb2b 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -811,6 +811,10 @@ class Reline::LineEditor i = 0 while i < @byte_pointer do slice = @line.byteslice(i, @byte_pointer - i) + unless slice.valid_encoding? + i += 1 + next + end if quote and slice.start_with?(/(?!\\)#{Regexp.escape(quote)}/) # closing " quote = nil i += 1 |