summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-12-03 01:17:07 +0900
committeraycabta <aycabta@gmail.com>2019-12-03 01:39:59 +0900
commita92560132b1bff6a01782cfeacd62756b4b34d21 (patch)
tree240caff6dba5dabc52823ab7cb13e7c707ef21ce /test
parentbce38f706e9c434d8fd7c0e2e14bb4acdd085777 (diff)
Support incremental search by last determined word
In the incremental search by C-r, search word is saved when it's determined. In the next incremental search by C-r, if a user presses C-r again with the empty search word, the determined previous search word is used to search.
Diffstat (limited to 'test')
-rw-r--r--test/reline/test_key_actor_emacs.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/reline/test_key_actor_emacs.rb b/test/reline/test_key_actor_emacs.rb
index 6ec583b3ef..8a80bc88f5 100644
--- a/test/reline/test_key_actor_emacs.rb
+++ b/test/reline/test_key_actor_emacs.rb
@@ -1474,6 +1474,43 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase
assert_cursor_max(0)
end
+ def test_search_history_by_last_determined
+ Reline::HISTORY.concat([
+ '1235', # old
+ '12aa',
+ '1234' # new
+ ])
+ assert_line('')
+ assert_byte_pointer_size('')
+ assert_cursor(0)
+ assert_cursor_max(0)
+ input_keys("\C-r123")
+ assert_line('1234')
+ assert_byte_pointer_size('')
+ assert_cursor(0)
+ assert_cursor_max(0) # doesn't determine yet
+ input_keys("\C-j")
+ assert_line('1234')
+ assert_byte_pointer_size('')
+ assert_cursor(0)
+ assert_cursor_max(4)
+ input_keys("\C-k") # delete
+ assert_line('')
+ assert_byte_pointer_size('')
+ assert_cursor(0)
+ assert_cursor_max(0)
+ input_keys("\C-r")
+ assert_line('')
+ assert_byte_pointer_size('')
+ assert_cursor(0)
+ assert_cursor_max(0)
+ input_keys("\C-r")
+ assert_line('1235')
+ assert_byte_pointer_size('')
+ assert_cursor(0)
+ assert_cursor_max(0)
+ end
+
def test_em_set_mark_and_em_exchange_mark
input_keys('aaa bbb ccc ddd')
assert_byte_pointer_size('aaa bbb ccc ddd')