diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-12-06 07:41:33 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2022-12-06 07:51:32 +0800 |
| commit | 10af0549df7ac4ea9907b34624228755b9752318 (patch) | |
| tree | 9e113f5daa3a13d8f20e543af113c402ea562fa9 /src/nvim/testdir | |
| parent | 6f9cda0f0a9d2e38654e4a0afc4701a356efb862 (diff) | |
| download | rneovim-10af0549df7ac4ea9907b34624228755b9752318.tar.gz rneovim-10af0549df7ac4ea9907b34624228755b9752318.tar.bz2 rneovim-10af0549df7ac4ea9907b34624228755b9752318.zip | |
vim-patch:8.2.4389: screenpos() does not handle a position in a closed fold
Problem: screenpos() does not handle a position in a closed fold.
Solution: Check if the position is inside a closed fold. (closes vim/vim#9778)
https://github.com/vim/vim/commit/4556a2e8681c5c98fb4c7ca0a016924a69b4452a
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_cursor_func.vim | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/nvim/testdir/test_cursor_func.vim b/src/nvim/testdir/test_cursor_func.vim index b08eb328b7..ad78adfc09 100644 --- a/src/nvim/testdir/test_cursor_func.vim +++ b/src/nvim/testdir/test_cursor_func.vim @@ -1,7 +1,10 @@ " Tests for cursor() and other functions that get/set the cursor position +source check.vim + func Test_wrong_arguments() call assert_fails('call cursor(1. 3)', 'E474:') + call assert_fails('call cursor(v:_null_list)', 'E474:') endfunc func Test_move_cursor() @@ -118,14 +121,29 @@ func Test_screenpos() bwipe! set display& - call assert_equal({'col': 1, 'row': 1, 'endcol': 1, 'curscol': 1}, screenpos(win_getid(), 1, 1)) + call assert_equal(#{col: 1, row: 1, endcol: 1, curscol: 1}, screenpos(win_getid(), 1, 1)) " nmenu WinBar.TEST : setlocal winbar=TEST - call assert_equal({'col': 1, 'row': 2, 'endcol': 1, 'curscol': 1}, screenpos(win_getid(), 1, 1)) + call assert_equal(#{col: 1, row: 2, endcol: 1, curscol: 1}, screenpos(win_getid(), 1, 1)) " nunmenu WinBar.TEST setlocal winbar& endfunc +func Test_screenpos_fold() + CheckFeature folding + + enew! + call setline(1, range(10)) + 3,5fold + redraw + call assert_equal(2, screenpos(1, 2, 1).row) + call assert_equal(#{col: 1, row: 3, endcol: 1, curscol: 1}, screenpos(1, 3, 1)) + call assert_equal(3, screenpos(1, 4, 1).row) + call assert_equal(3, screenpos(1, 5, 1).row) + call assert_equal(4, screenpos(1, 6, 1).row) + bwipe! +endfunc + func Test_screenpos_number() rightbelow new rightbelow 73vsplit |