updated for version 7.3.502
Problem: Netbeans insert halfway a line actually appends to the line.
Solution: Insert halfway the line. (Brian Victor)
diff --git a/src/netbeans.c b/src/netbeans.c
index e38d883..d2f4ce4 100644
--- a/src/netbeans.c
+++ b/src/netbeans.c
@@ -1812,14 +1812,15 @@
char_u *oldline = ml_get(lnum);
char_u *newline;
- /* Insert halfway a line. For simplicity we assume we
- * need to append to the line. */
+ /* Insert halfway a line. */
newline = alloc_check(
(unsigned)(STRLEN(oldline) + len + 1));
if (newline != NULL)
{
- STRCPY(newline, oldline);
+ mch_memmove(newline, oldline, (size_t)pos->col);
+ newline[pos->col] = NUL;
STRCAT(newline, args);
+ STRCAT(newline, oldline + pos->col);
ml_replace(lnum, newline, FALSE);
}
}