]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.2152: screenpos() does not include the WinBar offset v8.2.2152
authorBram Moolenaar <Bram@vim.org>
Thu, 17 Dec 2020 20:35:29 +0000 (21:35 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 17 Dec 2020 20:35:29 +0000 (21:35 +0100)
Problem:    screenpos() does not include the WinBar offset.
Solution:   Use W_WINROW() instead of directly using w_window. (closes #7487)

src/move.c
src/testdir/test_cursor_func.vim
src/version.c

index cd903793e59c13e39c8a19bb4e22bfe9e5c66ed6..69091fd3da4f25c0a4ddd4cc903ea6bb8bacc6fc 100644 (file)
@@ -1247,7 +1247,7 @@ textpos2screenpos(
            // character is left or right of the window
            row = scol = ccol = ecol = 0;
     }
-    *rowp = wp->w_winrow + row + rowoff;
+    *rowp = W_WINROW(wp) + row + rowoff;
     *scolp = scol + coloff;
     *ccolp = ccol + coloff;
     *ecolp = ecol + coloff;
index bfb908d38c4dffba4c41f90cd51009a95d1795d3..d914067b26d284893b086d06f54c94e439c88780 100644 (file)
@@ -101,6 +101,11 @@ func Test_screenpos()
   close
   call assert_equal({}, screenpos(999, 1, 1))
   bwipe!
+
+  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))
+  nunmenu WinBar.TEST
 endfunc
 
 func Test_screenpos_number()
index 43daa6dd827ccf001b8e003c50478472c209dcbb..3e6451843c7d499c080eb0c6fe875ede07960df6 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2152,
 /**/
     2151,
 /**/