aboutsummaryrefslogtreecommitdiff
path: root/test/old
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-18 09:01:50 +0800
committerGitHub <noreply@github.com>2023-08-18 09:01:50 +0800
commitc54682f75aca8785a4ee9e32b8dc44a1012c3e39 (patch)
tree4d5e1101aac5deb862885d54c6fca4f11a11ce71 /test/old
parentf8afa8023ee032dfb2aa9a6489f51484fb276732 (diff)
downloadrneovim-c54682f75aca8785a4ee9e32b8dc44a1012c3e39.tar.gz
rneovim-c54682f75aca8785a4ee9e32b8dc44a1012c3e39.tar.bz2
rneovim-c54682f75aca8785a4ee9e32b8dc44a1012c3e39.zip
vim-patch:9.0.1729: screenpos() wrong when w_skipcol and cpoptions+=n (#24773)
Problem: screenpos() wrong result with w_skipcol and cpoptions+=n Solution: Use adjust_plines_for_skipcol() instead of subtracting w_skipcol. closes: vim/vim#12625 https://github.com/vim/vim/commit/bfe377b8f2d080e5f85c8cbecf3533456e1d6312
Diffstat (limited to 'test/old')
-rw-r--r--test/old/testdir/test_cursor_func.vim79
1 files changed, 56 insertions, 23 deletions
diff --git a/test/old/testdir/test_cursor_func.vim b/test/old/testdir/test_cursor_func.vim
index e8b30226de..65abbf7c85 100644
--- a/test/old/testdir/test_cursor_func.vim
+++ b/test/old/testdir/test_cursor_func.vim
@@ -128,38 +128,71 @@ func Test_screenpos()
\ winid->screenpos(line('$'), 22))
1split
- normal G$
- redraw
- " w_skipcol should be subtracted
- call assert_equal({'row': winrow + 0,
- \ 'col': wincol + 20 - 1,
- \ 'curscol': wincol + 20 - 1,
- \ 'endcol': wincol + 20 - 1},
- \ screenpos(win_getid(), line('.'), col('.')))
" w_leftcol should be subtracted
setlocal nowrap
- normal 050zl$
+ normal G050zl$
+ redraw
call assert_equal({'row': winrow + 0,
\ 'col': wincol + 10 - 1,
\ 'curscol': wincol + 10 - 1,
\ 'endcol': wincol + 10 - 1},
\ screenpos(win_getid(), line('.'), col('.')))
- " w_skipcol should only matter for the topline
-" FIXME: This fails because pline_m_win() does not take w_skipcol into
-" account. If it does, then other tests fail.
-" wincmd +
-" setlocal wrap smoothscroll
-" call setline(line('$') + 1, 'last line')
-" exe "normal \<C-E>G$"
-" redraw
-" call assert_equal({'row': winrow + 1,
-" \ 'col': wincol + 9 - 1,
-" \ 'curscol': wincol + 9 - 1,
-" \ 'endcol': wincol + 9 - 1},
-" \ screenpos(win_getid(), line('.'), col('.')))
- close
+ " w_skipcol should be taken into account
+ setlocal wrap
+ normal $
+ redraw
+ call assert_equal({'row': winrow + 0,
+ \ 'col': wincol + 20 - 1,
+ \ 'curscol': wincol + 20 - 1,
+ \ 'endcol': wincol + 20 - 1},
+ \ screenpos(win_getid(), line('.'), col('.')))
+ call assert_equal({'row': 0, 'col': 0, 'curscol': 0, 'endcol': 0},
+ \ screenpos(win_getid(), line('.'), col('.') - 20))
+ setlocal number
+ redraw
+ call assert_equal({'row': winrow + 0,
+ \ 'col': wincol + 16 - 1,
+ \ 'curscol': wincol + 16 - 1,
+ \ 'endcol': wincol + 16 - 1},
+ \ screenpos(win_getid(), line('.'), col('.')))
+ call assert_equal({'row': 0, 'col': 0, 'curscol': 0, 'endcol': 0},
+ \ screenpos(win_getid(), line('.'), col('.') - 16))
+ set cpoptions+=n
+ redraw
+ call assert_equal({'row': winrow + 0,
+ \ 'col': wincol + 4 - 1,
+ \ 'curscol': wincol + 4 - 1,
+ \ 'endcol': wincol + 4 - 1},
+ \ screenpos(win_getid(), line('.'), col('.')))
+ call assert_equal({'row': 0, 'col': 0, 'curscol': 0, 'endcol': 0},
+ \ screenpos(win_getid(), line('.'), col('.') - 4))
+
+ wincmd +
+ call setline(line('$') + 1, 'last line')
+ setlocal smoothscroll
+ normal G$
+ redraw
+ call assert_equal({'row': winrow + 1,
+ \ 'col': wincol + 4 + 9 - 1,
+ \ 'curscol': wincol + 4 + 9 - 1,
+ \ 'endcol': wincol + 4 + 9 - 1},
+ \ screenpos(win_getid(), line('.'), col('.')))
+ set cpoptions-=n
+ redraw
+ call assert_equal({'row': winrow + 1,
+ \ 'col': wincol + 4 + 9 - 1,
+ \ 'curscol': wincol + 4 + 9 - 1,
+ \ 'endcol': wincol + 4 + 9 - 1},
+ \ screenpos(win_getid(), line('.'), col('.')))
+ setlocal nonumber
+ redraw
+ call assert_equal({'row': winrow + 1,
+ \ 'col': wincol + 9 - 1,
+ \ 'curscol': wincol + 9 - 1,
+ \ 'endcol': wincol + 9 - 1},
+ \ screenpos(win_getid(), line('.'), col('.')))
close
call assert_equal({}, screenpos(999, 1, 1))