diff options
Diffstat (limited to 'ui.c')
-rw-r--r-- | ui.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ui.c b/ui.c index 5cf62a1..2e028ff 100644 --- a/ui.c +++ b/ui.c @@ -350,7 +350,16 @@ static void delete(void) { static void enter(void) { if (line.end == line.buf) return; *line.end = L'\0'; - input(line.buf); + + const wchar_t *src = line.buf; + size_t len = wcsrtombs(NULL, &src, 0, NULL); + if (len == (size_t)-1) err(EX_DATAERR, "wcsrtombs"); + + char buf[1 + len]; + len = wcsrtombs(buf, &src, sizeof(buf), NULL); + if (len == (size_t)-1) err(EX_DATAERR, "wcsrtombs"); + + input(buf); line.ptr = line.buf; line.end = line.buf; } |