fix insert codepath for an annoying glibc

This commit is contained in:
sewn 2025-06-18 17:18:22 +03:00
parent 14edf4199d
commit e1785c7699
No known key found for this signature in database

2
mew.c
View file

@ -419,7 +419,7 @@ insert(const char *str, ssize_t n)
return; return;
/* move existing text out of the way, insert new text, and update cursor */ /* move existing text out of the way, insert new text, and update cursor */
memmove(&text[cursor + n], &text[cursor], sizeof text - cursor - MAX(n, 0)); memmove(&text[cursor + n], &text[cursor], sizeof text - cursor - MAX(n, 0));
if (n > 0) if (str)
memcpy(&text[cursor], str, n); memcpy(&text[cursor], str, n);
cursor += n; cursor += n;
match(); match();