diff options
author | Luuk van Baal <luukvbaal@gmail.com> | 2023-05-25 17:14:42 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-05-25 17:14:42 +0100 |
commit | 2ac6497f0ef186f0e3ba67d7f0a485bfb612bb08 (patch) | |
tree | 21d6369bb4620188ed97befa8e6afa952edbd92b /src/drawline.c | |
parent | 1271572a35ae215fa023d97db9896c5745591024 (diff) |
patch 9.0.1578: SpellCap highlight not always updated when neededv9.0.1578
Problem: SpellCap highlight not always updated when needed.
Solution: Handle updating line below closed fold and other situations where
only part of the window is redrawn. (Luuk van Baal, closes #12428,
closes #12420)
Diffstat (limited to 'src/drawline.c')
-rw-r--r-- | src/drawline.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/drawline.c b/src/drawline.c index e5fa15cbed..3791ece432 100644 --- a/src/drawline.c +++ b/src/drawline.c @@ -1062,7 +1062,7 @@ win_line( linenr_T lnum, int startrow, int endrow, - int nochange UNUSED, // not updating for changed text + int mod_top UNUSED, // top line updated for changed text int number_only) // only update the number column { winlinevars_T wlv; // variables passed between functions @@ -1314,11 +1314,18 @@ win_line( // When there was a sentence end in the previous line may require a // word starting with capital in this line. In line 1 always check - // the first word. - if (lnum != capcol_lnum) - cap_col = -1; - if (lnum == 1) + // the first word. Also check for sentence end in the line above + // when updating the first row in a window, the top line with + // changed text in a window, or if the previous line is folded. + if (lnum == 1 + || ((startrow == 0 || mod_top == lnum +#ifdef FEAT_FOLDING + || hasFoldingWin(wp, lnum - 1, NULL, NULL, TRUE, NULL) +#endif + ) && check_need_cap(wp, lnum, 0))) cap_col = 0; + else if (lnum != capcol_lnum) + cap_col = -1; capcol_lnum = 0; } #endif @@ -2787,7 +2794,7 @@ win_line( p = prev_ptr; cap_col -= (int)(prev_ptr - line); len = spell_check(wp, p, &spell_hlf, &cap_col, - nochange); + mod_top == 0); word_end = v + len; // In Insert mode only highlight a word that |