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

View File

@@ -501,7 +501,7 @@ open_line (
+ extra_len + extra_len
+ (second_line_indent > 0 ? second_line_indent : 0) + (second_line_indent > 0 ? second_line_indent : 0)
+ 1; + 1;
assert( bytes >= 0 ); assert(bytes >= 0);
leader = xmalloc((size_t)bytes); leader = xmalloc((size_t)bytes);
allocated = leader; // remember to free it later allocated = leader; // remember to free it later
@@ -1561,13 +1561,14 @@ void ins_str(char_u *s)
oldp = ml_get(lnum); oldp = ml_get(lnum);
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;