From 8d49821fddc1519229c01f4ef5d55b1d307173f8 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Fri, 10 May 2024 20:24:47 -0700 Subject: [PATCH] Allow input of utf8 characters --- src/modal.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/modal.c b/src/modal.c index 41bcb1d..5447fde 100644 --- a/src/modal.c +++ b/src/modal.c @@ -90,14 +90,6 @@ device_write(char *s) } } -static void -device_read(void) -{ - char c, *origin = dst_; - while(fread(&c, 1, 1, stdin) && c >= ' ') *dst_++ = c; - if(feof(stdin)) dst_ = copy("EOF", dst_, 3); -} - static char * file_import(char *path, char *ptr) { @@ -123,7 +115,12 @@ write_reg(char r, char *reg) { switch(r) { case ':': device_write(reg); return; - case '~': device_read(); return; + case '~': { + unsigned char c; + while(fread(&c, 1, 1, stdin) && c >= ' ') *dst_++ = c; + if(feof(stdin)) dst_ = copy("EOF", dst_, 3); + return; + } case '_': { char filepath[0x80]; copy(reg, filepath, walk(reg) - reg);