From 81ea44fa6aca27e6871d5baa158e2a5bcfa41981 Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Tue, 4 Mar 2025 19:45:21 +0100 Subject: fix(display): adjust winline info for concealed lines below last line (#32708) Problem: Last line in a window does not store correct `wl_lastlnum` if lines below it are concealed (resulting in e.g. incorrect cursor row). Solution: Increment `wl_lastlnum` while it points to a line above a concealed line. --- src/nvim/drawscreen.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c index a645dced40..c17bc2d999 100644 --- a/src/nvim/drawscreen.c +++ b/src/nvim/drawscreen.c @@ -2319,6 +2319,13 @@ static void win_update(win_T *wp) wp->w_lines[idx].wl_lastlnum = lnum + foldinfo.fi_lines; did_update = DID_FOLD; } + + // Adjust "wl_lastlnum" for concealed lines below the last line in the window. + while (row == wp->w_grid.rows + && decor_conceal_line(wp, wp->w_lines[idx].wl_lastlnum, false)) { + wp->w_lines[idx].wl_lastlnum++; + hasFolding(wp, wp->w_lines[idx].wl_lastlnum, NULL, &wp->w_lines[idx].wl_lastlnum); + } } wp->w_lines[idx].wl_lnum = lnum; -- cgit