comparison mcabber/src/screen.c @ 932:fc6aaa223650

Fix a few problems with non-UTF-8 locales
author Mikael Berthe <mikael@lilotux.net>
date Sat, 08 Jul 2006 09:43:18 +0200
parents 1cd6d694ac3c
children ede9260be93d
comparison
equal deleted inserted replaced
931:1cd6d694ac3c 932:fc6aaa223650
2219 break; 2219 break;
2220 } 2220 }
2221 } 2221 }
2222 // Right side 2222 // Right side
2223 if (direction >= 0) { 2223 if (direction >= 0) {
2224 int delta = wcwidth(get_char(c)); 2224 int delta = get_char_width(c);
2225 while (ptr_inputline > c) { 2225 while (ptr_inputline > c) {
2226 c = next_char(c); 2226 c = next_char(c);
2227 delta += wcwidth(get_char(c)); 2227 delta += get_char_width(c);
2228 } 2228 }
2229 c = &inputLine[inputline_offset]; 2229 c = &inputLine[inputline_offset];
2230 while (delta >= maxX) { 2230 while (delta >= maxX) {
2231 for (i = 0; i < 5; i++) { 2231 for (i = 0; i < 5; i++) {
2232 delta -= wcwidth(get_char(c)); 2232 delta -= get_char_width(c);
2233 c = next_char(c); 2233 c = next_char(c);
2234 } 2234 }
2235 } 2235 }
2236 } 2236 }
2237 inputline_offset = c - inputLine; 2237 inputline_offset = c - inputLine;
2650 display_char = TRUE; 2650 display_char = TRUE;
2651 } // switch 2651 } // switch
2652 2652
2653 display: 2653 display:
2654 if (display_char) { 2654 if (display_char) {
2655 if (iswprint(key) && (!utf8_mode || kcode.utf8 || key < 128)) { 2655 if (kcode.utf8 ? iswprint(key) : isprint(key)) {
2656 char tmpLine[INPUTLINE_LENGTH+1]; 2656 char tmpLine[INPUTLINE_LENGTH+1];
2657 2657
2658 // Check the line isn't too long 2658 // Check the line isn't too long
2659 if (strlen(inputLine) + 4 > INPUTLINE_LENGTH) 2659 if (strlen(inputLine) + 4 > INPUTLINE_LENGTH)
2660 return 0; 2660 return 0;