summaryrefslogtreecommitdiffstats
path: root/src/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-01-12 17:43:05 +0100
committerChristian Brabandt <cb@256bit.org>2024-01-12 17:43:05 +0100
commit424ec1f235a53131042aed94d30f6e2528e551d9 (patch)
treeacb863e4fea054f85e288966d89fc2952a7fdbdc /src/testdir
parent4f32c83a775a195ae7e1545b2840fb773f93414f (diff)
patch 9.1.0021: i_CTRL-R- doesn't work for multibyte chars in Replace modev9.1.0021
Problem: i_CTRL-R- doesn't work for multibyte chars in Replace mode, Coverity complains missing return value for u_save_cursor() Solution: Use mb_charlen() and del_chars() instead, handle failure mode for u_save_cursor() correctly (@zeertzjq) closes: #13846 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_registers.vim16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/testdir/test_registers.vim b/src/testdir/test_registers.vim
index 50f39107b4..367d914987 100644
--- a/src/testdir/test_registers.vim
+++ b/src/testdir/test_registers.vim
@@ -949,7 +949,7 @@ endfunc
func Test_insert_small_delete_replace_mode()
new
call setline(1, ['foo', 'bar', 'foobar', 'bar'])
- let @-='foo'
+ let @- = 'foo'
call cursor(2, 1)
exe ":norm! R\<C-R>-\<C-R>-"
call assert_equal('foofoo', getline(2))
@@ -960,9 +960,21 @@ func Test_insert_small_delete_replace_mode()
exe ":norm! R\<C-R>-ZZZZ"
call assert_equal(['foo', 'foofoo', '', 'bfoobarZZZZ'], getline(1, 4))
call cursor(1, 1)
- let @-=''
+ let @- = ''
exe ":norm! R\<C-R>-ZZZ"
call assert_equal(['ZZZ', 'foofoo', '', 'bfoobarZZZZ'], getline(1, 4))
+ let @- = 'βbβ'
+ call cursor(4, 1)
+ exe ":norm! R\<C-R>-"
+ call assert_equal(['ZZZ', 'foofoo', '', 'βbβobarZZZZ'], getline(1, 4))
+ let @- = 'bβb'
+ call cursor(4, 1)
+ exe ":norm! R\<C-R>-"
+ call assert_equal(['ZZZ', 'foofoo', '', 'bβbobarZZZZ'], getline(1, 4))
+ let @- = 'βbβ'
+ call cursor(4, 1)
+ exe ":norm! R\<C-R>-"
+ call assert_equal(['ZZZ', 'foofoo', '', 'βbβobarZZZZ'], getline(1, 4))
bwipe!
endfunc