aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-16 06:28:52 +0800
committerGitHub <noreply@github.com>2023-08-16 06:28:52 +0800
commita245dd79a267c8b56866023e84b49d0ecffca65b (patch)
treecae7c06afdb1e10be19d08a43af13df74df3724f /test
parent10c5f35a8ddf2683e0c849f71c02b81556ece902 (diff)
downloadrneovim-a245dd79a267c8b56866023e84b49d0ecffca65b.tar.gz
rneovim-a245dd79a267c8b56866023e84b49d0ecffca65b.tar.bz2
rneovim-a245dd79a267c8b56866023e84b49d0ecffca65b.zip
vim-patch:9.0.1717: virtcol2col returns last byte of a multi-byte char (#24729)
Problem: virtcol2col returns last byte of a multi-byte char Solution: Make it return the first byte for a multi-byte char closes: vim/vim#12786 closes: vim/vim#12799 https://github.com/vim/vim/commit/b209b86e6636a16088ccacdac98213416c065bf2 Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_cursor_func.vim9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/old/testdir/test_cursor_func.vim b/test/old/testdir/test_cursor_func.vim
index f73bd4f2b9..3d6ad8405c 100644
--- a/test/old/testdir/test_cursor_func.vim
+++ b/test/old/testdir/test_cursor_func.vim
@@ -531,6 +531,15 @@ func Test_virtcol2col()
call assert_equal(-1, virtcol2col(0, -1, 1))
call assert_equal(-1, virtcol2col(0, 1, -1))
call assert_equal(5, virtcol2col(0, 1, 20))
+
+ " Multibyte character
+ call setline(1, ['a✅✅✅'])
+ call assert_equal(1, virtcol2col(0, 1, 1))
+ call assert_equal(2, virtcol2col(0, 1, 3))
+ call assert_equal(5, virtcol2col(0, 1, 5))
+ call assert_equal(8, virtcol2col(0, 1, 7))
+ call assert_equal(8, virtcol2col(0, 1, 8))
+
call assert_fails('echo virtcol2col("0", 1, 20)', 'E1210:')
call assert_fails('echo virtcol2col(0, "1", 20)', 'E1210:')
call assert_fails('echo virtcol2col(0, 1, "1")', 'E1210:')