diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-06-05 06:58:44 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-06-05 08:45:32 +0800 |
commit | 7955c90621bb679f9c16b6788fbcb6145739886f (patch) | |
tree | babfc7fab6873ff516a0c3fe1dbc4708a20f883f /src | |
parent | 57fef392d265e2ef40c8c514749d658cb4d8d22a (diff) | |
download | rneovim-7955c90621bb679f9c16b6788fbcb6145739886f.tar.gz rneovim-7955c90621bb679f9c16b6788fbcb6145739886f.tar.bz2 rneovim-7955c90621bb679f9c16b6788fbcb6145739886f.zip |
fix(plines): folded lines with virt_lines attached to line above
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/move.c | 1 | ||||
-rw-r--r-- | src/nvim/plines.c | 15 |
2 files changed, 6 insertions, 10 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c index 4a6c2e1934..6fb6656472 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -1090,6 +1090,7 @@ void textpos2screenpos(win_T *wp, pos_T *pos, int *rowp, int *scolp, int *ccolp, row += local ? 0 : wp->w_winrow + wp->w_winrow_off; coloff = (local ? 0 : wp->w_wincol + wp->w_wincol_off) + 1 + off; } else { + assert(lnum == pos->lnum); getvcol(wp, pos, &scol, &ccol, &ecol); // similar to what is done in validate_cursor_col() diff --git a/src/nvim/plines.c b/src/nvim/plines.c index 25c745ae97..5f28715f53 100644 --- a/src/nvim/plines.c +++ b/src/nvim/plines.c @@ -38,8 +38,7 @@ /// @param winheight when true limit to window height int plines_win(win_T *wp, linenr_T lnum, bool winheight) { - // Check for filler lines above this buffer line. When folded the result - // is one line anyway. + // Check for filler lines above this buffer line. return plines_win_nofill(wp, lnum, winheight) + win_get_fill(wp, lnum); } @@ -199,16 +198,12 @@ int plines_win_col(win_T *wp, linenr_T lnum, long column) int plines_win_full(win_T *wp, linenr_T lnum, linenr_T *const nextp, bool *const foldedp, const bool cache, const bool winheight) { - bool folded = hasFoldingWin(wp, lnum, NULL, nextp, cache, NULL); - if (foldedp) { + bool folded = hasFoldingWin(wp, lnum, &lnum, nextp, cache, NULL); + if (foldedp != NULL) { *foldedp = folded; } - if (folded) { - return 1; - } else if (lnum == wp->w_topline) { - return plines_win_nofill(wp, lnum, winheight) + wp->w_topfill; - } - return plines_win(wp, lnum, winheight); + return ((folded ? 1 : plines_win_nofill(wp, lnum, winheight)) + + (lnum == wp->w_topline ? wp->w_topfill : win_get_fill(wp, lnum))); } int plines_m_win(win_T *wp, linenr_T first, linenr_T last) |