commit 22f4120146ffce1e10d090de9b5ae97dc3c5c7dd parent 4c1a3cf1d257b337ed1d6c1c00b486df46dd4519 Author: hhvn <dev@hhvn.uk> Date: Sun, 13 Mar 2022 18:09:31 +0000 Fix input insertion Diffstat:
M | src/ui.c | | | 5 | ++++- |
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/ui.c b/src/ui.c @@ -490,7 +490,10 @@ ui_read(void) { } break; default: - if (iswprint(key) || iscntrl(key)) + if (iswprint(key) || iscntrl(key) && input.counter + 1 != sizeof(input.string)) { + memmove(input.string + input.counter + 1, + input.string + input.counter, + (wcslen(input.string + input.counter) + 1) * sizeof(wchar_t)); input.string[input.counter++] = (wchar_t)key; input.string[input.counter] = 0; break;