aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-02-09 08:30:58 +0800
committerzeertzjq <zeertzjq@outlook.com>2025-02-09 08:46:55 +0800
commit6f0a91579f3b5d30d23420249a74fba432a27a24 (patch)
tree0f0f0ef5c355ad2f81d60b4d3306f3121f5da40f /test
parent00bce2723fb3b6e36bb7b0b0570c33ffc9508b78 (diff)
downloadrneovim-6f0a91579f3b5d30d23420249a74fba432a27a24.tar.gz
rneovim-6f0a91579f3b5d30d23420249a74fba432a27a24.tar.bz2
rneovim-6f0a91579f3b5d30d23420249a74fba432a27a24.zip
vim-patch:9.1.1083: setreg() doesn't correctly handle mbyte chars in blockwise mode
Problem: setreg() doesn't correctly handle mbyte chars in blockwise mode Solution: use mb_ptr2len_len function pointer (Yee Cheng Chin) setreg() will automatically calculate the width when a blockwise mode is specified, but it does not properly calculate the line widths of mbyte characters when value is passed as newline-terminated string. It does work when value is passed as a list of lines though. Fix this by properly using the mbyte function pointer to increment the loop counter. closes: vim/vim#16596 https://github.com/vim/vim/commit/a17f8bfb282805ee8ded014089d3094ef6dbf913 Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_registers.vim17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/old/testdir/test_registers.vim b/test/old/testdir/test_registers.vim
index e5add9414f..fbacdaa2a0 100644
--- a/test/old/testdir/test_registers.vim
+++ b/test/old/testdir/test_registers.vim
@@ -435,6 +435,23 @@ func Test_set_register()
enew!
endfunc
+" Test for blockwise register width calculations
+func Test_set_register_blockwise_width()
+ " Test for regular calculations and overriding the width
+ call setreg('a', "12\n1234\n123", 'b')
+ call assert_equal("\<c-v>4", getreginfo('a').regtype)
+ call setreg('a', "12\n1234\n123", 'b1')
+ call assert_equal("\<c-v>1", getreginfo('a').regtype)
+ call setreg('a', "12\n1234\n123", 'b6')
+ call assert_equal("\<c-v>6", getreginfo('a').regtype)
+
+ " Test for Unicode parsing
+ call setreg('a', "z😅😅z\n12345", 'b')
+ call assert_equal("\<c-v>6", getreginfo('a').regtype)
+ call setreg('a', ["z😅😅z", "12345"], 'b')
+ call assert_equal("\<c-v>6", getreginfo('a').regtype)
+endfunc
+
" Test for clipboard registers (* and +)
func Test_clipboard_regs()
throw 'skipped: needs clipboard=autoselect,autoselectplus'