commit 3b6df3ae55689e77c58e89fdb92e0f832e1340c2
parent ba6fc90b6fb701a081f4deaa4669e63a1749a0bb
Author: zeertzjq <zeertzjq@outlook.com>
Date: Thu, 20 Nov 2025 10:45:08 +0800
refactor: avoid unnecessary redraw for non-curwin cursor line (#36607)
Diffstat:
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c
@@ -2808,7 +2808,7 @@ bool conceal_cursor_line(const win_T *wp)
bool win_cursorline_standout(const win_T *wp)
FUNC_ATTR_NONNULL_ALL
{
- return wp->w_p_cul || (wp->w_p_cole > 0 && !conceal_cursor_line(wp));
+ return wp->w_p_cul || (wp == curwin && wp->w_p_cole > 0 && !conceal_cursor_line(wp));
}
/// Update w_cursorline, taking care to set it to the to the start of a closed fold.
diff --git a/src/nvim/move.c b/src/nvim/move.c
@@ -157,7 +157,7 @@ static void redraw_for_cursorcolumn(win_T *wp)
{
// If the cursor moves horizontally when 'concealcursor' is active, then the
// current line needs to be redrawn to calculate the correct cursor position.
- if (wp->w_p_cole > 0 && conceal_cursor_line(wp)) {
+ if (wp == curwin && wp->w_p_cole > 0 && conceal_cursor_line(wp)) {
redrawWinline(wp, wp->w_cursor.lnum);
}
@@ -513,7 +513,8 @@ void check_cursor_moved(win_T *wp)
|VALID_CHEIGHT|VALID_CROW|VALID_TOPLINE);
// Concealed line visibility toggled.
- if (wp->w_valid_cursor.lnum > 0 && wp->w_p_cole >= 2 && !conceal_cursor_line(wp)
+ if (wp == curwin && wp->w_valid_cursor.lnum > 0 && wp->w_p_cole >= 2
+ && !conceal_cursor_line(wp)
&& (decor_conceal_line(wp, wp->w_cursor.lnum - 1, true)
|| decor_conceal_line(wp, wp->w_valid_cursor.lnum - 1, true))) {
changed_window_setting(wp);