Mercurial > vim
comparison src/testdir/test_cursor_func.vim @ 25312:7a254d0705e2 v8.2.3193
patch 8.2.3193: screenpos() is wrong when 'display' is "lastline"
Commit: https://github.com/vim/vim/commit/189663bdac1156237c49925f77bd197c1bdea12c
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jul 21 18:04:56 2021 +0200
patch 8.2.3193: screenpos() is wrong when 'display' is "lastline"
Problem: screenpos() is wrong when the last line is partially visible and
'display' is "lastline".
Solution: Also compute the position for a partially visible line.
(closes #8599)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 21 Jul 2021 18:15:05 +0200 |
parents | 8df4e9e2394f |
children | fb67cd7d30a7 |
comparison
equal
deleted
inserted
replaced
25311:0eb4d41d5495 | 25312:7a254d0705e2 |
---|---|
99 setlocal number | 99 setlocal number |
100 call assert_equal({'row': winrow + 3, | 100 call assert_equal({'row': winrow + 3, |
101 \ 'col': wincol + 9, | 101 \ 'col': wincol + 9, |
102 \ 'curscol': wincol + 9, | 102 \ 'curscol': wincol + 9, |
103 \ 'endcol': wincol + 9}, screenpos(winid, 2, 22)) | 103 \ 'endcol': wincol + 9}, screenpos(winid, 2, 22)) |
104 | |
105 let wininfo = getwininfo(winid)[0] | |
106 call setline(3, ['x']->repeat(wininfo.height)) | |
107 call setline(line('$') + 1, 'x'->repeat(wininfo.width * 3)) | |
108 setlocal nonumber display=lastline so=0 | |
109 exe "normal G\<C-Y>\<C-Y>" | |
110 redraw | |
111 call assert_equal({'row': winrow + wininfo.height - 1, | |
112 \ 'col': wincol + 7, | |
113 \ 'curscol': wincol + 7, | |
114 \ 'endcol': wincol + 7}, winid->screenpos(line('$'), 8)) | |
115 call assert_equal({'row': winrow - 1, 'col': 0, 'curscol': 0, 'endcol': 0}, | |
116 \ winid->screenpos(line('$'), 22)) | |
117 | |
104 close | 118 close |
105 call assert_equal({}, screenpos(999, 1, 1)) | 119 call assert_equal({}, screenpos(999, 1, 1)) |
120 | |
106 bwipe! | 121 bwipe! |
122 set display& | |
107 | 123 |
108 call assert_equal({'col': 1, 'row': 1, 'endcol': 1, 'curscol': 1}, screenpos(win_getid(), 1, 1)) | 124 call assert_equal({'col': 1, 'row': 1, 'endcol': 1, 'curscol': 1}, screenpos(win_getid(), 1, 1)) |
109 nmenu WinBar.TEST : | 125 nmenu WinBar.TEST : |
110 call assert_equal({'col': 1, 'row': 2, 'endcol': 1, 'curscol': 1}, screenpos(win_getid(), 1, 1)) | 126 call assert_equal({'col': 1, 'row': 2, 'endcol': 1, 'curscol': 1}, screenpos(win_getid(), 1, 1)) |
111 nunmenu WinBar.TEST | 127 nunmenu WinBar.TEST |