From 40d97468cad92fd28997ffdf595665437826b64e Mon Sep 17 00:00:00 2001 From: Emanuele Giaquinta Date: Sat, 9 Sep 2006 13:56:00 +0000 Subject: [PATCH] Add support for wide curses. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4331 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-text/term-curses.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/fe-text/term-curses.c b/src/fe-text/term-curses.c index ca7db091..cdede07d 100644 --- a/src/fe-text/term-curses.c +++ b/src/fe-text/term-curses.c @@ -319,6 +319,15 @@ void term_addch(TERM_WINDOW *window, int chr) void term_add_unichar(TERM_WINDOW *window, unichar chr) { +#ifdef WIDEC_CURSES + cchar_t wch; + wchar_t temp[2]; + temp[0] = chr; + temp[1] = 0; + if (setcchar(&wch, temp, A_NORMAL, 0, NULL) == OK) + wadd_wch(window->win, &wch); + else +#endif waddch(window->win, chr); } @@ -393,18 +402,25 @@ void term_set_input_type(int type) int term_gets(unichar *buffer, int size) { - int key, count; + int count; +#ifdef WIDEC_CURSES + wint_t key; +#else + int key; +#endif for (count = 0; count < size; ) { - key = getch(); +#ifdef WIDEC_CURSES + if (get_wch(&key) == ERR) +#else + if ((key = getch()) == ERR) +#endif + break; #ifdef KEY_RESIZE if (key == KEY_RESIZE) continue; #endif - if (key == ERR) - break; - buffer[count] = key; count++; }