Mercurial > vim
changeset 31365:040b59b92dca v9.0.1016
patch 9.0.1016: screenpos() does not count filler lines for diff mode
Commit: https://github.com/vim/vim/commit/1cb16c3a20a9d17df1a8dc3813ef64dc98e42637
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Dec 5 22:26:44 2022 +0000
patch 9.0.1016: screenpos() does not count filler lines for diff mode
Problem: screenpos() does not count filler lines for diff mode.
Solution: Add filler lines. (closes 11658)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 05 Dec 2022 23:30:04 +0100 |
parents | ba81163e2223 |
children | b650bd97bfab |
files | src/move.c src/testdir/test_cursor_func.vim src/version.c |
diffstat | 3 files changed, 24 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/move.c +++ b/src/move.c @@ -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) {
--- a/src/testdir/test_cursor_func.vim +++ b/src/testdir/test_cursor_func.vim @@ -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