diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-02-15 13:40:17 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-02-15 13:40:17 +0000 |
commit | 4556a2e8681c5c98fb4c7ca0a016924a69b4452a (patch) | |
tree | 7f5cb71bb3b4713c2fc9a10465cf320834c063c9 /src/testdir/test_cursor_func.vim | |
parent | 7745f14ef324a7134b2f26a47451cf5032f44b89 (diff) | |
download | vim-git-4556a2e8681c5c98fb4c7ca0a016924a69b4452a.tar.gz |
patch 8.2.4389: screenpos() does not handle a position in a closed foldv8.2.4389
Problem: screenpos() does not handle a position in a closed fold.
Solution: Check if the position is inside a closed fold. (closes #9778)
Diffstat (limited to 'src/testdir/test_cursor_func.vim')
-rw-r--r-- | src/testdir/test_cursor_func.vim | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/testdir/test_cursor_func.vim b/src/testdir/test_cursor_func.vim index bc12511af..7d21d8472 100644 --- a/src/testdir/test_cursor_func.vim +++ b/src/testdir/test_cursor_func.vim @@ -1,5 +1,7 @@ " 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(test_null_list())', 'E474:') @@ -133,12 +135,27 @@ 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 : - 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 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 |