diff options
author | bfredl <bjorn.linse@gmail.com> | 2022-03-31 10:56:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-31 10:56:15 +0200 |
commit | b2bd8004161853f53bf687b0b90119055fcb5cfb (patch) | |
tree | 61da0ef02bc7dbdfff8e232a9e36efe87676c293 /src/nvim/move.c | |
parent | 1184097261260e53519db54548acf2c1e5ab7e68 (diff) | |
parent | 595c1a724af9fe93d4ff1df7d5c47e4c9c31a7a6 (diff) | |
download | rneovim-b2bd8004161853f53bf687b0b90119055fcb5cfb.tar.gz rneovim-b2bd8004161853f53bf687b0b90119055fcb5cfb.tar.bz2 rneovim-b2bd8004161853f53bf687b0b90119055fcb5cfb.zip |
Merge pull request #17890 from zeertzjq/conceal-virtcol-changed
perf: only redraw concealed line if cursor has moved horizontally
Diffstat (limited to 'src/nvim/move.c')
-rw-r--r-- | src/nvim/move.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c index 9b35a7da0a..5e02e355bf 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -96,12 +96,12 @@ static void comp_botline(win_T *wp) } /// Redraw when w_cline_row changes and 'relativenumber' or 'cursorline' is set. +/// Also when concealing is on and 'concealcursor' is not active. void redraw_for_cursorline(win_T *wp) FUNC_ATTR_NONNULL_ALL { - if ((wp->w_p_rnu || win_cursorline_standout(wp)) - && (wp->w_valid & VALID_CROW) == 0 - && !pum_visible()) { + if ((wp->w_valid & VALID_CROW) == 0 && !pum_visible() + && (wp->w_p_rnu || win_cursorline_standout(wp))) { // win_line() will redraw the number column and cursorline only. redraw_later(wp, VALID); } @@ -109,6 +109,7 @@ void redraw_for_cursorline(win_T *wp) /// Redraw when w_virtcol changes and 'cursorcolumn' is set or 'cursorlineopt' /// contains "screenline". +/// Also when concealing is on and 'concealcursor' is active. static void redraw_for_cursorcolumn(win_T *wp) FUNC_ATTR_NONNULL_ALL { @@ -121,6 +122,12 @@ static void redraw_for_cursorcolumn(win_T *wp) redraw_later(wp, VALID); } } + // If the cursor moves horizontally when 'concealcursor' is active, then the + // current line needs to be redrawn in order to calculate the correct + // cursor position. + if ((wp->w_valid & VALID_VIRTCOL) == 0 && wp->w_p_cole > 0 && conceal_cursor_line(wp)) { + redrawWinline(wp, wp->w_cursor.lnum); + } } /* |