From 42e2a322f100c7c798fcfbcbbfe0b4cdaf3f5855 Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 24 Dec 2019 18:32:50 +0900 Subject: The delete-char-or-list shows completed list when called at end of line It doesn't behave the same as the delete-char. --- test/reline/test_key_actor_emacs.rb | 43 ++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) (limited to 'test/reline/test_key_actor_emacs.rb') diff --git a/test/reline/test_key_actor_emacs.rb b/test/reline/test_key_actor_emacs.rb index 8854df56a2..97ff654506 100644 --- a/test/reline/test_key_actor_emacs.rb +++ b/test/reline/test_key_actor_emacs.rb @@ -372,7 +372,7 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase assert_line('abcd012ABCa') end - def test_em_delete_or_list + def test_em_delete input_keys('ab') assert_byte_pointer_size('ab') assert_cursor(2) @@ -388,7 +388,7 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase assert_line('b') end - def test_em_delete_or_list_for_mbchar + def test_em_delete_for_mbchar input_keys('かき') assert_byte_pointer_size('かき') assert_cursor(4) @@ -407,7 +407,7 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase assert_line('き') end - def test_em_delete_or_list_for_mbchar_by_plural_code_points + def test_em_delete_for_mbchar_by_plural_code_points input_keys("か\u3099き\u3099") assert_byte_pointer_size("か\u3099き\u3099") assert_cursor(4) @@ -1244,6 +1244,43 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase assert_line('{}#* AAA!!!CCC ') end + def test_em_delete_or_list + @line_editor.completion_proc = proc { |word| + %w{ + foo_foo + foo_bar + foo_baz + qux + }.map { |i| + i.encode(@encoding) + } + } + input_keys('fooo') + assert_byte_pointer_size('fooo') + assert_cursor(4) + assert_cursor_max(4) + assert_line('fooo') + assert_equal(nil, @line_editor.instance_variable_get(:@menu_info)) + input_keys("\C-b", false) + assert_byte_pointer_size('foo') + assert_cursor(3) + assert_cursor_max(4) + assert_line('fooo') + assert_equal(nil, @line_editor.instance_variable_get(:@menu_info)) + @line_editor.input_key(Reline::Key.new(:em_delete_or_list, :em_delete_or_list, false)) + assert_byte_pointer_size('foo') + assert_cursor(3) + assert_cursor_max(3) + assert_line('foo') + assert_equal(nil, @line_editor.instance_variable_get(:@menu_info)) + @line_editor.input_key(Reline::Key.new(:em_delete_or_list, :em_delete_or_list, false)) + assert_byte_pointer_size('foo') + assert_cursor(3) + assert_cursor_max(3) + assert_line('foo') + assert_equal(%w{foo_foo foo_bar foo_baz}, @line_editor.instance_variable_get(:@menu_info).list) + end + def test_completion @line_editor.completion_proc = proc { |word| %w{ -- cgit v1.2.3