Skip to content

Commit 8dd46e7

Browse files
committed
patch 8.2.2152: screenpos() does not include the WinBar offset
Problem: screenpos() does not include the WinBar offset. Solution: Use W_WINROW() instead of directly using w_window. (closes #7487)
1 parent a79a894 commit 8dd46e7

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/move.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,7 @@ textpos2screenpos(
12471247
// character is left or right of the window
12481248
row = scol = ccol = ecol = 0;
12491249
}
1250-
*rowp = wp->w_winrow + row + rowoff;
1250+
*rowp = W_WINROW(wp) + row + rowoff;
12511251
*scolp = scol + coloff;
12521252
*ccolp = ccol + coloff;
12531253
*ecolp = ecol + coloff;

src/testdir/test_cursor_func.vim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ func Test_screenpos()
101101
close
102102
call assert_equal({}, screenpos(999, 1, 1))
103103
bwipe!
104+
105+
call assert_equal({'col': 1, 'row': 1, 'endcol': 1, 'curscol': 1}, screenpos(win_getid(), 1, 1))
106+
nmenu WinBar.TEST :
107+
call assert_equal({'col': 1, 'row': 2, 'endcol': 1, 'curscol': 1}, screenpos(win_getid(), 1, 1))
108+
nunmenu WinBar.TEST
104109
endfunc
105110

106111
func Test_screenpos_number()

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2152,
753755
/**/
754756
2151,
755757
/**/

0 commit comments

Comments
 (0)