fix(folds): cursorline highlight is not always applied on closed folds (#22242)

Problem:    The cursorline highlight logic checks for `w_cursor.lnum`
            which may be different from the line number passed to
            `win_line()` even when the cursor is actually on that line.
Solution:   Update cursor line highlight logic to check for the line
            number of the start of a closed fold if necessary.
This commit is contained in:
luukvbaal
2023-02-14 08:52:22 +01:00
committed by GitHub
parent 20c9f4b352
commit 5396808267
4 changed files with 127 additions and 73 deletions

View File

@@ -1112,20 +1112,23 @@ struct window_S {
win_T *w_prev; ///< link to previous window
win_T *w_next; ///< link to next window
bool w_closing; ///< window is being closed, don't let
/// autocommands close it too.
///< autocommands close it too.
frame_T *w_frame; ///< frame containing this window
pos_T w_cursor; ///< cursor position in buffer
colnr_T w_curswant; ///< Column we want to be at. This is
/// used to try to stay in the same column
/// for up/down cursor motions.
///< used to try to stay in the same column
///< for up/down cursor motions.
int w_set_curswant; // If set, then update w_curswant the next
// time through cursupdate() to the
// current virtual column
linenr_T w_cursorline; ///< Where 'cursorline' should be drawn,
///< can be different from w_cursor.lnum
///< for closed folds.
linenr_T w_last_cursorline; ///< where last 'cursorline' was drawn
pos_T w_last_cursormoved; ///< for CursorMoved event