diff options
author | aycabta <aycabta@gmail.com> | 2019-12-17 12:47:09 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2019-12-17 13:07:19 +0900 |
commit | a14a0244b48c422e392547b198af6fb57f7ca568 (patch) | |
tree | 6e8e4a1101642f250d9939cd0a41009417231e5d /test/reline | |
parent | c687be4bc01c9ce52ea990945d9304d6fe59fe9b (diff) |
Support forward-search-history by C-s
Diffstat (limited to 'test/reline')
-rw-r--r-- | test/reline/test_key_actor_emacs.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/reline/test_key_actor_emacs.rb b/test/reline/test_key_actor_emacs.rb index 7ffa28ec87..5e5be0c15c 100644 --- a/test/reline/test_key_actor_emacs.rb +++ b/test/reline/test_key_actor_emacs.rb @@ -6,6 +6,7 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase @prompt = '> ' @config = Reline::Config.new # Emacs mode is default Reline::HISTORY.instance_variable_set(:@config, @config) + Reline::HISTORY.clear @encoding = (RELINE_TEST_ENCODING rescue Encoding.default_external) @line_editor = Reline::LineEditor.new(@config) @line_editor.reset(@prompt, @encoding) @@ -1592,6 +1593,33 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase assert_cursor_max(0) end + def test_search_history_to_front + Reline::HISTORY.concat([ + '1235', # old + '12aa', + '1234' # new + ]) + assert_line('') + assert_byte_pointer_size('') + assert_cursor(0) + assert_cursor_max(0) + input_keys("\C-s123") + assert_line('1235') + assert_byte_pointer_size('') + assert_cursor(0) + assert_cursor_max(0) # doesn't determine yet + input_keys("\C-ha") + assert_line('12aa') + assert_byte_pointer_size('') + assert_cursor(0) + assert_cursor_max(0) + input_keys("\C-h3") + assert_line('1234') + assert_byte_pointer_size('') + assert_cursor(0) + assert_cursor_max(0) + end + def test_search_history_to_back_in_the_middle_of_histories Reline::HISTORY.concat([ '1235', # old |