aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuuk van Baal <luukvbaal@gmail.com>2023-05-24 19:50:01 +0200
committerLuuk van Baal <luukvbaal@gmail.com>2023-05-25 01:13:47 +0200
commitbff67c9fbe8c174dae8952a565a110930dc4fc58 (patch)
tree81fc21ff55ea16ab5ca4dbb2b7c0a1124472a2b1 /src
parent678548a2b44601db73cc7d049467abd2b433baae (diff)
downloadrneovim-bff67c9fbe8c174dae8952a565a110930dc4fc58.tar.gz
rneovim-bff67c9fbe8c174dae8952a565a110930dc4fc58.tar.bz2
rneovim-bff67c9fbe8c174dae8952a565a110930dc4fc58.zip
vim-patch:9.0.0175: spell checking for capital not working with trailing space
Problem: Spell checking for capital not working with trailing space. Solution: Do not calculate cap_col at the end of the line. (Christian Brabandt, closes vim/vim#10870, issue vim/vim#10838) https://github.com/vim/vim/commit/afa23d1b99692e3c726eb694933ab348b442a1e4 Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src')
-rw-r--r--src/nvim/drawline.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c
index 927b1247be..a49b2ac6d6 100644
--- a/src/nvim/drawline.c
+++ b/src/nvim/drawline.c
@@ -2188,12 +2188,13 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange,
v = (ptr - line);
if (has_spell && v >= word_end && v > cur_checked_col) {
spell_attr = 0;
- if (c != 0 && ((!has_syntax && !no_plain_buffer) || can_spell)) {
- char *prev_ptr;
+ char *prev_ptr = ptr - mb_l;
+ // do not calculate cap_col at the end of the line or when
+ // only white space is following
+ if (c != 0 && (*skipwhite(prev_ptr) != NUL)
+ && ((!has_syntax && !no_plain_buffer) || can_spell)) {
char *p;
- int len;
hlf_T spell_hlf = HLF_COUNT;
- prev_ptr = ptr - mb_l;
v -= mb_l - 1;
// Use nextline[] if possible, it has the start of the
@@ -2206,7 +2207,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange,
cap_col -= (int)(prev_ptr - line);
size_t tmplen = spell_check(wp, p, &spell_hlf, &cap_col, nochange);
assert(tmplen <= INT_MAX);
- len = (int)tmplen;
+ int len = (int)tmplen;
word_end = (int)v + len;
// In Insert mode only highlight a word that