diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-03-29 17:50:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-29 17:50:55 +0800 |
commit | fc19ee01acc30bac371f5a56a97a5cdfe8094014 (patch) | |
tree | 8365314e0b46039ac69abb2b7ea5814a966e19ae /test | |
parent | d223a7cbd2a204fffeb220fb18dfede8f4ef3e1f (diff) | |
download | rneovim-fc19ee01acc30bac371f5a56a97a5cdfe8094014.tar.gz rneovim-fc19ee01acc30bac371f5a56a97a5cdfe8094014.tar.bz2 rneovim-fc19ee01acc30bac371f5a56a97a5cdfe8094014.zip |
vim-patch:9.1.0227: Recording may still be wrong in Select mode (#28092)
Problem: Recording may still be wrong in Select mode (after 8.2.3993).
Solution: Make sure a character isn't split between two buffer blocks.
(zeertzjq)
closes: vim/vim#14326
https://github.com/vim/vim/commit/ea95f1a5ad2455c7fd1eee2413ac7a3460ef4f8a
Diffstat (limited to 'test')
-rw-r--r-- | test/old/testdir/test_registers.vim | 52 | ||||
-rw-r--r-- | test/old/testdir/test_utf8.vim | 51 |
2 files changed, 52 insertions, 51 deletions
diff --git a/test/old/testdir/test_registers.vim b/test/old/testdir/test_registers.vim index e113bd9e75..1a25844ad3 100644 --- a/test/old/testdir/test_registers.vim +++ b/test/old/testdir/test_registers.vim @@ -214,6 +214,58 @@ func Test_recording_with_select_mode() bwipe! endfunc +func Run_test_recording_with_select_mode_utf8() + new + + " Test with different text lengths: 5, 7, 9, 11, 13, 15, to check that + " a character isn't split between two buffer blocks. + for s in ['12345', '口=口', '口口口', '口=口=口', '口口=口口', '口口口口口'] + " 0x80 is K_SPECIAL + " 0x9B is CSI + " 哦: 0xE5 0x93 0xA6 + " 洛: 0xE6 0xB4 0x9B + " 固: 0xE5 0x9B 0xBA + " 四: 0xE5 0x9B 0x9B + " 最: 0xE6 0x9C 0x80 + " 倒: 0xE5 0x80 0x92 + " 倀: 0xE5 0x80 0x80 + for c in ['哦', '洛', '固', '四', '最', '倒', '倀'] + call setline(1, 'asdf') + call feedkeys($"qacc{s}\<Esc>gH{c}\<Esc>q", "tx") + call assert_equal(c, getline(1)) + call assert_equal($"cc{s}\<Esc>gH{c}\<Esc>", @a) + call setline(1, 'asdf') + normal! @a + call assert_equal(c, getline(1)) + + " Test with Shift modifier. + let shift_c = eval($'"\<S-{c}>"') + call setline(1, 'asdf') + call feedkeys($"qacc{s}\<Esc>gH{shift_c}\<Esc>q", "tx") + call assert_equal(c, getline(1)) + call assert_equal($"cc{s}\<Esc>gH{shift_c}\<Esc>", @a) + call setline(1, 'asdf') + normal! @a + call assert_equal(c, getline(1)) + endfor + endfor + + bwipe! +endfunc + +func Test_recording_with_select_mode_utf8() + call Run_test_recording_with_select_mode_utf8() +endfunc + +" This must be done as one of the last tests, because it starts the GUI, which +" cannot be undone. +func Test_zz_recording_with_select_mode_utf8_gui() + CheckCanRunGui + + gui -f + call Run_test_recording_with_select_mode_utf8() +endfunc + " Test for executing the last used register (@) func Test_last_used_exec_reg() " Test for the @: command diff --git a/test/old/testdir/test_utf8.vim b/test/old/testdir/test_utf8.vim index a5a9624ec3..920000e2c7 100644 --- a/test/old/testdir/test_utf8.vim +++ b/test/old/testdir/test_utf8.vim @@ -292,55 +292,4 @@ func Test_print_overlong() bwipe! endfunc -func Test_recording_with_select_mode_utf8() - call Run_test_recording_with_select_mode_utf8() -endfunc - -func Run_test_recording_with_select_mode_utf8() - new - - " No escaping - call feedkeys("qacc12345\<Esc>gH哦\<Esc>q", "tx") - call assert_equal("哦", getline(1)) - call assert_equal("cc12345\<Esc>gH哦\<Esc>", @a) - call setline(1, 'asdf') - normal! @a - call assert_equal("哦", getline(1)) - - " 固 is 0xE5 0x9B 0xBA where 0x9B is CSI - call feedkeys("qacc12345\<Esc>gH固\<Esc>q", "tx") - call assert_equal("固", getline(1)) - call assert_equal("cc12345\<Esc>gH固\<Esc>", @a) - call setline(1, 'asdf') - normal! @a - call assert_equal("固", getline(1)) - - " 四 is 0xE5 0x9B 0x9B where 0x9B is CSI - call feedkeys("qacc12345\<Esc>gH四\<Esc>q", "tx") - call assert_equal("四", getline(1)) - call assert_equal("cc12345\<Esc>gH四\<Esc>", @a) - call setline(1, 'asdf') - normal! @a - call assert_equal("四", getline(1)) - - " 倒 is 0xE5 0x80 0x92 where 0x80 is K_SPECIAL - call feedkeys("qacc12345\<Esc>gH倒\<Esc>q", "tx") - call assert_equal("倒", getline(1)) - call assert_equal("cc12345\<Esc>gH倒\<Esc>", @a) - call setline(1, 'asdf') - normal! @a - call assert_equal("倒", getline(1)) - - bwipe! -endfunc - -" This must be done as one of the last tests, because it starts the GUI, which -" cannot be undone. -func Test_zz_recording_with_select_mode_utf8_gui() - CheckCanRunGui - - gui -f - call Run_test_recording_with_select_mode_utf8() -endfunc - " vim: shiftwidth=2 sts=2 expandtab |