This commit is contained in:
Ihor Antonov
2019-07-16 08:32:09 -04:00
parent 6262d82d2f
commit 96e87c5a63

View File

@@ -1562,12 +1562,13 @@ void ins_str(char_u *s)
oldlen = (int)STRLEN(oldp); oldlen = (int)STRLEN(oldp);
newp = (char_u *)xmalloc((size_t)oldlen + (size_t)newlen + 1); newp = (char_u *)xmalloc((size_t)oldlen + (size_t)newlen + 1);
if (col > 0) if (col > 0) {
memmove(newp, oldp, (size_t)col); memmove(newp, oldp, (size_t)col);
}
memmove(newp + col, s, (size_t)newlen); memmove(newp + col, s, (size_t)newlen);
int bytes = oldlen - col + 1; int bytes = oldlen - col + 1;
assert(bytes >= 0); assert(bytes >= 0);
memmove(newp + col + newlen, oldp + col, bytes); memmove(newp + col + newlen, oldp + col, (size_t)bytes);
ml_replace(lnum, newp, false); ml_replace(lnum, newp, false);
changed_bytes(lnum, col); changed_bytes(lnum, col);
curwin->w_cursor.col += newlen; curwin->w_cursor.col += newlen;