aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/spell.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-04 11:13:19 +0800
committerGitHub <noreply@github.com>2022-07-04 11:13:19 +0800
commitf075feee3258d15f6549e33c185f6165f9c7fbfc (patch)
tree749fe579f2987a6da072e912f2b08a06c1bc4761 /src/nvim/spell.c
parentacb7a902812a064fced5ef7d389bd94cb45764bb (diff)
parent6b474d0237a1ec9b5b027e5d1fb738be38a57347 (diff)
downloadrneovim-f075feee3258d15f6549e33c185f6165f9c7fbfc.tar.gz
rneovim-f075feee3258d15f6549e33c185f6165f9c7fbfc.tar.bz2
rneovim-f075feee3258d15f6549e33c185f6165f9c7fbfc.zip
Merge pull request #19220 from zeertzjq/vim-8.2.1470
vim-patch:8.2.{1470,1493,1522,1523,1770,5072,5074}: spell patches
Diffstat (limited to 'src/nvim/spell.c')
-rw-r--r--src/nvim/spell.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 304fd30b36..0fedd27037 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -1469,7 +1469,9 @@ size_t spell_move_to(win_T *wp, int dir, bool allwords, bool curline, hlf_T *att
}
// Copy the line into "buf" and append the start of the next line if
- // possible.
+ // possible. Note: this ml_get_buf() may make "line" invalid, check
+ // for empty line first.
+ bool empty_line = *skipwhite((const char *)line) == NUL;
STRCPY(buf, line);
if (lnum < wp->w_buffer->b_ml.ml_line_count) {
spell_cat_line(buf + STRLEN(buf),
@@ -1613,7 +1615,7 @@ size_t spell_move_to(win_T *wp, int dir, bool allwords, bool curline, hlf_T *att
--capcol;
// But after empty line check first word in next line
- if (*skipwhite((char *)line) == NUL) {
+ if (empty_line) {
capcol = 0;
}
}
@@ -2327,11 +2329,11 @@ char *did_set_spelllang(win_T *wp)
}
}
}
+ redraw_later(wp, NOT_VALID);
theend:
xfree(spl_copy);
recursive = false;
- redraw_later(wp, NOT_VALID);
return ret_msg;
}