Fix display of some UTF-8 chars
There was a conflict between the keycode and ncurses special keys. This
patch should fix it.
--- 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)