diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-09-12 18:10:13 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-12 18:10:13 +0800 |
| commit | 2ea6584a1b798bc7bb77d97735c77c0c7ce38706 (patch) | |
| tree | ca90a565370f46fd84ddf052c5769e04ede33e00 /src/nvim/testdir | |
| parent | 738c204523e4da07468268ae89741f2c86887031 (diff) | |
| parent | 245ac6f263b6017c050f885212ee80e5738d3b9f (diff) | |
| download | rneovim-2ea6584a1b798bc7bb77d97735c77c0c7ce38706.tar.gz rneovim-2ea6584a1b798bc7bb77d97735c77c0c7ce38706.tar.bz2 rneovim-2ea6584a1b798bc7bb77d97735c77c0c7ce38706.zip | |
Merge pull request #20163 from zeertzjq/vim-8.2.5034
vim-patch:8.2.5034: there is no way to get the byte index from a virtual column
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_cursor_func.vim | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_cursor_func.vim b/src/nvim/testdir/test_cursor_func.vim index f13842edc8..2e625f2388 100644 --- a/src/nvim/testdir/test_cursor_func.vim +++ b/src/nvim/testdir/test_cursor_func.vim @@ -373,4 +373,26 @@ func Test_setcursorcharpos() %bw! endfunc +" Test for virtcol2col() +func Test_virtcol2col() + new + call setline(1, ["a\tb\tc"]) + call assert_equal(1, virtcol2col(0, 1, 1)) + call assert_equal(2, virtcol2col(0, 1, 2)) + call assert_equal(2, virtcol2col(0, 1, 8)) + call assert_equal(3, virtcol2col(0, 1, 9)) + call assert_equal(4, virtcol2col(0, 1, 10)) + call assert_equal(4, virtcol2col(0, 1, 16)) + call assert_equal(5, virtcol2col(0, 1, 17)) + call assert_equal(-1, virtcol2col(10, 1, 1)) + call assert_equal(-1, virtcol2col(0, 10, 1)) + call assert_equal(-1, virtcol2col(0, -1, 1)) + call assert_equal(-1, virtcol2col(0, 1, -1)) + call assert_equal(5, virtcol2col(0, 1, 20)) + 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:') + bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab |