neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 51fd328184fcb33b105775cc426132f2e18528bc
parent ac1ad9651e88eef1eea92fe5bd1497344c83dc53
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Thu,  1 Jun 2023 20:49:31 +0800

refactor(drawscreen): avoid spell check on folded or filler lines

Diffstat:
Msrc/nvim/drawline.c | 8++++----
Msrc/nvim/drawscreen.c | 13++++++++-----
2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c @@ -1403,16 +1403,16 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl line = ml_get_buf(wp->w_buffer, lnum + 1, false); spell_cat_line(nextline + SPWORDLEN, line, SPWORDLEN); } - line = end_fill ? "" : ml_get_buf(wp->w_buffer, lnum, false); + assert(!end_fill); + line = ml_get_buf(wp->w_buffer, lnum, false); // If current line is empty, check first word in next line for capital. ptr = skipwhite(line); if (*ptr == NUL) { spv->spv_cap_col = 0; spv->spv_capcol_lnum = lnum + 1; - } - // For checking first word with a capital skip white space. - else if (spv->spv_cap_col == 0) { + } else if (spv->spv_cap_col == 0) { + // For checking first word with a capital skip white space. spv->spv_cap_col = (int)(ptr - line); } diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c @@ -2230,8 +2230,10 @@ static void win_update(win_T *wp, DecorProviders *providers) } // Display one line - row = win_line(wp, lnum, srow, foldinfo.fi_lines ? srow : wp->w_grid.rows, - false, &spv, foldinfo, &line_providers, &provider_err); + spellvars_T zero_spv = { 0 }; + row = win_line(wp, lnum, srow, foldinfo.fi_lines ? srow : wp->w_grid.rows, false, + foldinfo.fi_lines ? &zero_spv : &spv, + foldinfo, &line_providers, &provider_err); if (foldinfo.fi_lines == 0) { wp->w_lines[idx].wl_folded = false; @@ -2366,9 +2368,10 @@ static void win_update(win_T *wp, DecorProviders *providers) if (j > 0 && !wp->w_botfill && row < wp->w_grid.rows) { // Display filler text below last line. win_line() will check // for ml_line_count+1 and only draw filler lines - foldinfo_T info = { 0 }; - row = win_line(wp, wp->w_botline, row, wp->w_grid.rows, - false, &spv, info, &line_providers, &provider_err); + spellvars_T zero_spv = { 0 }; + foldinfo_T zero_foldinfo = { 0 }; + row = win_line(wp, wp->w_botline, row, wp->w_grid.rows, false, &zero_spv, + zero_foldinfo, &line_providers, &provider_err); } } else if (dollar_vcol == -1) { wp->w_botline = lnum;