Skip to content

Commit

Permalink
patch 9.0.1016: screenpos() does not count filler lines for diff mode
Browse files Browse the repository at this point in the history
Problem:    screenpos() does not count filler lines for diff mode.
Solution:   Add filler lines. (closes 11658)
  • Loading branch information
brammool committed Dec 5, 2022
1 parent f0a9c00 commit 1cb16c3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/move.c
Expand Up @@ -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)
{
Expand Down
16 changes: 16 additions & 0 deletions src/testdir/test_cursor_func.vim
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -695,6 +695,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1016,
/**/
1015,
/**/
Expand Down

0 comments on commit 1cb16c3

Please sign in to comment.