aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/spell.c
diff options
context:
space:
mode:
authorMatthieu Coudron <mattator@gmail.com>2020-07-06 23:31:24 +0200
committerGitHub <noreply@github.com>2020-07-06 23:31:24 +0200
commite49fc4ba1f27d968b2a104a14633459ad6091ca3 (patch)
treeee3d32344ec0cba95c64c76169c9607e9a94d72d /src/nvim/spell.c
parent4ab7bbf3eaeacc32e8970b76a19c8682f98cc183 (diff)
parent10c563577cc11b0af4c465a68f17b0a8976631f8 (diff)
downloadrneovim-e49fc4ba1f27d968b2a104a14633459ad6091ca3.tar.gz
rneovim-e49fc4ba1f27d968b2a104a14633459ad6091ca3.tar.bz2
rneovim-e49fc4ba1f27d968b2a104a14633459ad6091ca3.zip
Merge pull request #12538 from janlazo/vim-8.2.1055
vim-patch:8.1.{93,1372},8.2.{1055,1060,1089,1095,1104}
Diffstat (limited to 'src/nvim/spell.c')
-rw-r--r--src/nvim/spell.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 4d8da1ba14..95948dac78 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -2930,8 +2930,6 @@ void spell_suggest(int count)
memmove(p, line, c);
STRCPY(p + c, stp->st_word);
STRCAT(p, sug.su_badptr + stp->st_orglen);
- ml_replace(curwin->w_cursor.lnum, p, false);
- curwin->w_cursor.col = c;
// For redo we use a change-word command.
ResetRedobuff();
@@ -2940,7 +2938,10 @@ void spell_suggest(int count)
stp->st_wordlen + sug.su_badlen - stp->st_orglen);
AppendCharToRedobuff(ESC);
- // After this "p" may be invalid.
+ // "p" may be freed here
+ ml_replace(curwin->w_cursor.lnum, p, false);
+ curwin->w_cursor.col = c;
+
changed_bytes(curwin->w_cursor.lnum, c);
} else
curwin->w_cursor = prev_cursor;
@@ -3761,7 +3762,8 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
tword[sp->ts_twordlen] = NUL;
if (sp->ts_prefixdepth <= PFD_NOTSPECIAL
- && (sp->ts_flags & TSF_PREFIXOK) == 0) {
+ && (sp->ts_flags & TSF_PREFIXOK) == 0
+ && pbyts != NULL) {
// There was a prefix before the word. Check that the prefix
// can be used with this word.
// Count the length of the NULs in the prefix. If there are