Mercurial > vim
comparison src/testdir/test_cursor_func.vim @ 27726:d3ed8b1a7bde v8.2.4389
patch 8.2.4389: screenpos() does not handle a position in a closed fold
Commit: https://github.com/vim/vim/commit/4556a2e8681c5c98fb4c7ca0a016924a69b4452a
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 15 13:40:17 2022 +0000
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 https://github.com/vim/vim/issues/9778)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 15 Feb 2022 14:45:03 +0100 |
parents | 2bec1976362c |
children | 6e501ecd1bb7 |
comparison
equal
deleted
inserted
replaced
27725:8c46546e1e2f | 27726:d3ed8b1a7bde |
---|---|
1 " Tests for cursor() and other functions that get/set the cursor position | 1 " Tests for cursor() and other functions that get/set the cursor position |
2 | |
3 source check.vim | |
2 | 4 |
3 func Test_wrong_arguments() | 5 func Test_wrong_arguments() |
4 call assert_fails('call cursor(1. 3)', 'E474:') | 6 call assert_fails('call cursor(1. 3)', 'E474:') |
5 call assert_fails('call cursor(test_null_list())', 'E474:') | 7 call assert_fails('call cursor(test_null_list())', 'E474:') |
6 endfunc | 8 endfunc |
131 call assert_equal({}, screenpos(999, 1, 1)) | 133 call assert_equal({}, screenpos(999, 1, 1)) |
132 | 134 |
133 bwipe! | 135 bwipe! |
134 set display& | 136 set display& |
135 | 137 |
136 call assert_equal({'col': 1, 'row': 1, 'endcol': 1, 'curscol': 1}, screenpos(win_getid(), 1, 1)) | 138 call assert_equal(#{col: 1, row: 1, endcol: 1, curscol: 1}, screenpos(win_getid(), 1, 1)) |
137 nmenu WinBar.TEST : | 139 nmenu WinBar.TEST : |
138 call assert_equal({'col': 1, 'row': 2, 'endcol': 1, 'curscol': 1}, screenpos(win_getid(), 1, 1)) | 140 call assert_equal(#{col: 1, row: 2, endcol: 1, curscol: 1}, screenpos(win_getid(), 1, 1)) |
139 nunmenu WinBar.TEST | 141 nunmenu WinBar.TEST |
142 endfunc | |
143 | |
144 func Test_screenpos_fold() | |
145 CheckFeature folding | |
146 | |
147 enew! | |
148 call setline(1, range(10)) | |
149 3,5fold | |
150 redraw | |
151 call assert_equal(2, screenpos(1, 2, 1).row) | |
152 call assert_equal(#{col: 1, row: 3, endcol: 1, curscol: 1}, screenpos(1, 3, 1)) | |
153 call assert_equal(3, screenpos(1, 4, 1).row) | |
154 call assert_equal(3, screenpos(1, 5, 1).row) | |
155 call assert_equal(4, screenpos(1, 6, 1).row) | |
156 bwipe! | |
140 endfunc | 157 endfunc |
141 | 158 |
142 func Test_screenpos_number() | 159 func Test_screenpos_number() |
143 rightbelow new | 160 rightbelow new |
144 rightbelow 73vsplit | 161 rightbelow 73vsplit |