patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Problem: Text properties not adjusted when accepting spell suggestion.
Solution: Adjust text properties when text changes. (closes #10414)
diff --git a/src/spellsuggest.c b/src/spellsuggest.c
index ecb5455..4a71438 100644
--- a/src/spellsuggest.c
+++ b/src/spellsuggest.c
@@ -681,6 +681,8 @@
p = alloc(STRLEN(line) - stp->st_orglen + stp->st_wordlen + 1);
if (p != NULL)
{
+ int len_diff = stp->st_wordlen - stp->st_orglen;
+
c = (int)(sug.su_badptr - line);
mch_memmove(p, line, c);
STRCPY(p + c, stp->st_word);
@@ -698,6 +700,9 @@
curwin->w_cursor.col = c;
changed_bytes(curwin->w_cursor.lnum, c);
+ if (curbuf->b_has_textprop && len_diff != 0)
+ adjust_prop_columns(curwin->w_cursor.lnum, c, len_diff,
+ APC_SUBSTITUTE);
}
}
else