diff options
author | Luuk van Baal <luukvbaal@gmail.com> | 2023-05-31 21:13:58 +0200 |
---|---|---|
committer | Luuk van Baal <luukvbaal@gmail.com> | 2023-06-01 14:30:21 +0200 |
commit | ac1ad9651e88eef1eea92fe5bd1497344c83dc53 (patch) | |
tree | cc51da671524745045ff24a44ee947124ae1f7d6 /src/nvim/drawscreen.c | |
parent | 316c8770348264f64deea34359cb5bdff6856ed8 (diff) | |
download | rneovim-ac1ad9651e88eef1eea92fe5bd1497344c83dc53.tar.gz rneovim-ac1ad9651e88eef1eea92fe5bd1497344c83dc53.tar.bz2 rneovim-ac1ad9651e88eef1eea92fe5bd1497344c83dc53.zip |
vim-patch:9.0.1595: line pointer becomes invalid when using spell checking
Problem: Line pointer becomes invalid when using spell checking.
Solution: Call ml_get() at the right places. (Luuk van Baal, closes vim/vim#12456)
https://github.com/vim/vim/commit/e84c773d42e8b6ef0f8ae9b6c7312e0fd47909af
Diffstat (limited to 'src/nvim/drawscreen.c')
-rw-r--r-- | src/nvim/drawscreen.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c index 5e8481cd29..842e3fadff 100644 --- a/src/nvim/drawscreen.c +++ b/src/nvim/drawscreen.c @@ -1995,11 +1995,9 @@ static void win_update(win_T *wp, DecorProviders *providers) spellvars_T spv = { 0 }; linenr_T lnum = wp->w_topline; // first line shown in window // Initialize spell related variables for the first drawn line. - spv.spv_has_spell = spell_check_window(wp); - if (spv.spv_has_spell) { + if (spell_check_window(wp)) { + spv.spv_has_spell = true; spv.spv_unchanged = mod_top == 0; - spv.spv_capcol_lnum = mod_top ? mod_top : lnum; - spv.spv_cap_col = check_need_cap(wp, spv.spv_capcol_lnum, 0) ? 0 : -1; } // Update all the window rows. @@ -2242,16 +2240,10 @@ static void win_update(win_T *wp, DecorProviders *providers) syntax_last_parsed = lnum; } else { foldinfo.fi_lines--; - linenr_T lnume = lnum + foldinfo.fi_lines; wp->w_lines[idx].wl_folded = true; - wp->w_lines[idx].wl_lastlnum = lnume; - - // Check if the line after this fold requires a capital. - if (spv.spv_has_spell && check_need_cap(wp, lnume + 1, 0)) { - spv.spv_cap_col = 0; - spv.spv_capcol_lnum = lnume + 1; - } + wp->w_lines[idx].wl_lastlnum = lnum + foldinfo.fi_lines; did_update = DID_FOLD; + spv.spv_capcol_lnum = 0; } } @@ -2288,6 +2280,7 @@ static void win_update(win_T *wp, DecorProviders *providers) } lnum = wp->w_lines[idx - 1].wl_lastlnum + 1; did_update = DID_NONE; + spv.spv_capcol_lnum = 0; } // 'statuscolumn' width has changed or errored, start from the top. |