From e84c773d42e8b6ef0f8ae9b6c7312e0fd47909af Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 31 May 2023 18:57:36 +0100 Subject: 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 #12456) --- src/drawscreen.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/drawscreen.c') diff --git a/src/drawscreen.c b/src/drawscreen.c index 9676f1b0f0..86fec15026 100644 --- a/src/drawscreen.c +++ b/src/drawscreen.c @@ -2197,12 +2197,10 @@ win_update(win_T *wp) #ifdef FEAT_SPELL // Initialize spell related variables for the first drawn line. CLEAR_FIELD(spv); - 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; } #endif @@ -2464,19 +2462,13 @@ win_update(win_T *wp) fold_line(wp, fold_count, &win_foldinfo, lnum, row); ++row; --fold_count; - linenr_T lnume = lnum + fold_count; wp->w_lines[idx].wl_folded = TRUE; - wp->w_lines[idx].wl_lastlnum = lnume; + wp->w_lines[idx].wl_lastlnum = lnum + fold_count; # ifdef FEAT_SYN_HL did_update = DID_FOLD; # endif # ifdef FEAT_SPELL - // 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; - } + spv.spv_capcol_lnum = 0; # endif } else @@ -2571,6 +2563,9 @@ win_update(win_T *wp) #endif #ifdef FEAT_SYN_HL did_update = DID_NONE; +#endif +#ifdef FEAT_SPELL + spv.spv_capcol_lnum = 0; #endif } -- cgit v1.2.3