# HG changeset patch # User Mikael Berthe # Date 1152344581 -7200 # Node ID 1cd6d694ac3c9b07cf437e569ede8f92f129b6f8 # Parent a75f7a13df7b6b28d3ced3a0128040a749041e64 Fix display of some UTF-8 chars There was a conflict between the keycode and ncurses special keys. This patch should fix it. diff -r a75f7a13df7b -r 1cd6d694ac3c mcabber/src/screen.c --- a/mcabber/src/screen.c Sat Jul 08 09:40:05 2006 +0200 +++ b/mcabber/src/screen.c Sat Jul 08 09:43:01 2006 +0200 @@ -2449,6 +2449,7 @@ int process_key(keycode kcode) { int key = kcode.value; + int display_char = FALSE; switch (kcode.mcode) { case 0: @@ -2473,6 +2474,12 @@ key = ERR; // Do not process any further } + if (kcode.utf8) { + if (key != ERR && !kcode.mcode) + display_char = TRUE; + goto display; + } + switch (key) { case 0: case ERR: @@ -2640,23 +2647,28 @@ update_panels(); break; default: - if (iswprint(key) && (!utf8_mode || kcode.utf8 || key < 128)) { - char tmpLine[INPUTLINE_LENGTH+1]; + display_char = TRUE; + } // switch - // Check the line isn't too long - if (strlen(inputLine) + 4 > INPUTLINE_LENGTH) - return 0; +display: + if (display_char) { + if (iswprint(key) && (!utf8_mode || kcode.utf8 || key < 128)) { + char tmpLine[INPUTLINE_LENGTH+1]; - // Insert char - strcpy(tmpLine, ptr_inputline); - ptr_inputline = put_char(ptr_inputline, key); - strcpy(ptr_inputline, tmpLine); - check_offset(1); - } else { - // Look for a key binding. - if (bindcommand(kcode) == 255) - return 255; - } + // Check the line isn't too long + if (strlen(inputLine) + 4 > INPUTLINE_LENGTH) + return 0; + + // Insert char + strcpy(tmpLine, ptr_inputline); + ptr_inputline = put_char(ptr_inputline, key); + strcpy(ptr_inputline, tmpLine); + check_offset(1); + } else { + // Look for a key binding. + if (!kcode.utf8 && (bindcommand(kcode) == 255)) + return 255; + } } if (completion_started && key != 9 && key != KEY_RESIZE)