]> granicus.if.org Git - vim/commitdiff
patch 9.0.1016: screenpos() does not count filler lines for diff mode v9.0.1016
authorBram Moolenaar <Bram@vim.org>
Mon, 5 Dec 2022 22:26:44 +0000 (22:26 +0000)
committerBram Moolenaar <Bram@vim.org>
Mon, 5 Dec 2022 22:26:44 +0000 (22:26 +0000)
Problem:    screenpos() does not count filler lines for diff mode.
Solution:   Add filler lines. (closes 11658)

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

index 954a13714d6fffca75015925e52f2214b235f400..fde7f20e253cd8aa77d51957f0fd9e69ad8843be 100644 (file)
@@ -1426,6 +1426,12 @@ textpos2screenpos(
        is_folded = hasFoldingWin(wp, lnum, &lnum, NULL, TRUE, NULL);
 #endif
        row = plines_m_win(wp, wp->w_topline, lnum - 1) + 1;
+
+#ifdef FEAT_DIFF
+       // Add filler lines above this buffer line.
+       row += diff_check_fill(wp, lnum);
+#endif
+
 #ifdef FEAT_FOLDING
        if (is_folded)
        {
index 8bdc956e269842a63aaf92dbc16dc2a117f622a9..fe64be0e71f51be84bcb1824d522edfe7d9c0f65 100644 (file)
@@ -156,6 +156,22 @@ func Test_screenpos_fold()
   bwipe!
 endfunc
 
+func Test_screenpos_diff()
+  CheckFeature diff
+
+  enew!
+  call setline(1, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'])
+  vnew
+  call setline(1, ['a', 'b', 'c', 'g', 'h', 'i'])
+  windo diffthis
+  wincmd w
+  call assert_equal(#{col: 3, row: 7, endcol: 3, curscol: 3}, screenpos(0, 4, 1))
+
+  windo diffoff
+  bwipe!
+  bwipe!
+endfunc
+
 func Test_screenpos_number()
   rightbelow new
   rightbelow 73vsplit
index a19d947653fb63995784aea942ff43ce61da2adc..3dbc0a0a53db0f13b620081986ae66dca75bbc66 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1016,
 /**/
     1015,
 /**/