From 1e65196b54644c5a8fe53c98643ab7e87dfb87c0 Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 14 May 2019 04:08:23 +0900 Subject: Check encoding when Readline completion --- lib/reline/line_editor.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 86fc4d9bba..a37c9d8508 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -405,7 +405,10 @@ class Reline::LineEditor private def complete_internal_proc(list, is_menu) preposing, target, postposing = @retrieve_completion_block.(@line, @byte_pointer) - list = list.select { |i| i&.start_with?(target) } + list = list.select { |i| + raise Encoding::CompatibilityError if i and i.encoding != @encoding + i&.start_with?(target) + } if is_menu menu(target, list) return nil -- cgit v1.2.3