summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-07-25 17:19:11 +0900
committeraycabta <aycabta@gmail.com>2019-07-25 17:19:16 +0900
commit0f9ec4a877496278534e5956b640ed43a02229ad (patch)
tree8a8f585ddfff66921a72a0486baff3479482e21a
parent8e53d18e6724211bd0597ec5852869e6bf9679f1 (diff)
Check wether multibyte character is split
-rw-r--r--lib/reline/line_editor.rb4
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