summaryrefslogtreecommitdiff
path: root/test/reline
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-06-06 04:57:52 +0900
committeraycabta <aycabta@gmail.com>2019-06-06 04:57:52 +0900
commit02880d1f4a9ebd1c0a807376fcb25ccd908334b4 (patch)
tree08420a2ab7cfe3737c9fde4c35ade5d4fb9a36e6 /test/reline
parentfd173372285f9575e424f854d8072b5f71fce1e2 (diff)
Skip transpose-words if less than 2 word
Diffstat (limited to 'test/reline')
-rw-r--r--test/reline/test_key_actor_emacs.rb76
1 files changed, 76 insertions, 0 deletions
diff --git a/test/reline/test_key_actor_emacs.rb b/test/reline/test_key_actor_emacs.rb
index 4194659631..04edf6b31f 100644
--- a/test/reline/test_key_actor_emacs.rb
+++ b/test/reline/test_key_actor_emacs.rb
@@ -903,6 +903,82 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase
assert_cursor_max(18)
end
+ def test_ed_transpose_words_with_one_word
+ input_keys('abc ')
+ assert_line('abc ')
+ assert_byte_pointer_size('abc ')
+ assert_cursor(5)
+ assert_cursor_max(5)
+ input_keys("\M-t", false)
+ assert_line('abc ')
+ assert_byte_pointer_size('abc ')
+ assert_cursor(5)
+ assert_cursor_max(5)
+ input_keys("\C-b", false)
+ assert_line('abc ')
+ assert_byte_pointer_size('abc ')
+ assert_cursor(4)
+ assert_cursor_max(5)
+ input_keys("\M-t", false)
+ assert_line('abc ')
+ assert_byte_pointer_size('abc ')
+ assert_cursor(4)
+ assert_cursor_max(5)
+ input_keys("\C-b" * 2, false)
+ assert_line('abc ')
+ assert_byte_pointer_size('ab')
+ assert_cursor(2)
+ assert_cursor_max(5)
+ input_keys("\M-t", false)
+ assert_line('abc ')
+ assert_byte_pointer_size('ab')
+ assert_cursor(2)
+ assert_cursor_max(5)
+ input_keys("\M-t", false)
+ assert_line('abc ')
+ assert_byte_pointer_size('ab')
+ assert_cursor(2)
+ assert_cursor_max(5)
+ end
+
+ def test_ed_transpose_words_with_one_word_for_mbchar
+ input_keys('あいう ')
+ assert_line('あいう ')
+ assert_byte_pointer_size('あいう ')
+ assert_cursor(8)
+ assert_cursor_max(8)
+ input_keys("\M-t", false)
+ assert_line('あいう ')
+ assert_byte_pointer_size('あいう ')
+ assert_cursor(8)
+ assert_cursor_max(8)
+ input_keys("\C-b", false)
+ assert_line('あいう ')
+ assert_byte_pointer_size('あいう ')
+ assert_cursor(7)
+ assert_cursor_max(8)
+ input_keys("\M-t", false)
+ assert_line('あいう ')
+ assert_byte_pointer_size('あいう ')
+ assert_cursor(7)
+ assert_cursor_max(8)
+ input_keys("\C-b" * 2, false)
+ assert_line('あいう ')
+ assert_byte_pointer_size('あい')
+ assert_cursor(4)
+ assert_cursor_max(8)
+ input_keys("\M-t", false)
+ assert_line('あいう ')
+ assert_byte_pointer_size('あい')
+ assert_cursor(4)
+ assert_cursor_max(8)
+ input_keys("\M-t", false)
+ assert_line('あいう ')
+ assert_byte_pointer_size('あい')
+ assert_cursor(4)
+ assert_cursor_max(8)
+ end
+
def test_ed_digit
input_keys('0123')
assert_byte_pointer_size('0123')