From e0c512d452777a977a5838fab9990d286f8f42e7 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sat, 20 May 2006 05:45:57 +0000 Subject: [PATCH] * Make the ncurses driver UTF-8 and UTF-32 aware. * Add the backspace key to the ncurses driver. --- caca/driver_ncurses.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/caca/driver_ncurses.c b/caca/driver_ncurses.c index d8eca62..5dd18a9 100644 --- a/caca/driver_ncurses.c +++ b/caca/driver_ncurses.c @@ -238,10 +238,13 @@ static int ncurses_get_event(caca_display_t *dp, caca_event_t *ev) return 0; } - if(intkey < 0x100) + if(intkey < 0x80) { ev->type = CACA_EVENT_KEY_PRESS; ev->data.key.ch = intkey; + ev->data.key.utf32 = intkey; + ev->data.key.utf8[0] = intkey; + ev->data.key.utf8[1] = '\0'; return 1; } @@ -406,6 +409,7 @@ static int ncurses_get_event(caca_display_t *dp, caca_event_t *ev) case KEY_IC: ev->data.key.ch = CACA_KEY_INSERT; break; case KEY_DC: ev->data.key.ch = CACA_KEY_DELETE; break; + case KEY_BACKSPACE: ev->data.key.ch = CACA_KEY_BACKSPACE; break; case KEY_HOME: ev->data.key.ch = CACA_KEY_HOME; break; case KEY_END: ev->data.key.ch = CACA_KEY_END; break; case KEY_PPAGE: ev->data.key.ch = CACA_KEY_PAGEUP; break;