mirror of
https://github.com/neovim/neovim.git
synced 2025-09-24 20:18:32 +00:00
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
b209b86e66
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
@@ -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:')
|
||||
|
Reference in New Issue
Block a user