about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-01-03 01:03:14 +0000
committerJames Booth <boothj5@gmail.com>2013-01-03 01:03:14 +0000
commit73cdcb87efd3bc9bfc7bb88db5e434a8b5f63cf9 (patch)
tree239dc1a095cf5bad03dbbc2a16faac67e59900ad
parent439e6486db24fb18f0cb2ac22e16a6327e1d8ad4 (diff)
downloadprofani-tty-73cdcb87efd3bc9bfc7bb88db5e434a8b5f63cf9.tar.gz
Changed replace input to handle wide chars
-rw-r--r--src/input_win.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/input_win.c b/src/input_win.c
index 470f7cb9..ae8b400c 100644
--- a/src/input_win.c
+++ b/src/input_win.c
@@ -181,14 +181,17 @@ inp_get_char(char *input, int *size)
 
             // otherwise just append
             } else {
-                cchar_t t = { 0, { ch, 0 } };
-                wadd_wch(inp_win, &t);
+                //cchar_t t = { 0, { ch, 0 } };
+                //wadd_wch(inp_win, &t);
                 char bytes[5];
                 size_t utf_len = wcrtomb(bytes, ch, NULL);
                 int i;
                 for (i = 0 ; i < utf_len; i++) {
                     input[(*size)++] = bytes[i];
                 }
+                input[*size] = '\0';
+                inp_clear();
+                wprintw(inp_win, input);
 
                 display_size++;
 
@@ -247,8 +250,8 @@ inp_replace_input(char *input, const char * const new_input, int *size)
     strcpy(input, new_input);
     *size = strlen(input);
     inp_clear();
-    for (i = 0; i < *size; i++)
-        waddch(inp_win, input[i]);
+    input[*size] = '\0';
+    wprintw(inp_win, input);
 }