summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEmanuele Giaquinta <exg@irssi.org>2006-09-09 13:56:00 +0000
committerexg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564>2006-09-09 13:56:00 +0000
commit40d97468cad92fd28997ffdf595665437826b64e (patch)
tree89e9d637821091e970e187143c35e175f890048a /src
parenta59dfa003e84ae588657346cc889122cc472ed80 (diff)
downloadirssi-40d97468cad92fd28997ffdf595665437826b64e.zip
Add support for wide curses.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4331 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/fe-text/term-curses.c26
1 files 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++;
}