Changeset 2453
- Timestamp:
- Jun 18, 2008, 11:42:50 PM (14 years ago)
- Location:
- neercs/trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
neercs/trunk/src/main.c
r2451 r2453 211 211 if(ret && (caca_get_event_type(&ev) & CACA_EVENT_KEY_PRESS)) 212 212 { 213 unsigned int c = caca_get_event_key_ utf32(&ev);213 unsigned int c = caca_get_event_key_ch(&ev); 214 214 215 215 if(command) -
neercs/trunk/src/neercs.h
r2451 r2453 170 170 171 171 172 #if 1172 #if 0 173 173 # define debug(f, z...) fprintf(stderr, f "\n", z) 174 174 #else -
neercs/trunk/src/term.c
r2451 r2453 344 344 { 345 345 unsigned int bytes; 346 char tmp[7];347 346 348 347 if(i + 6 < size) … … 351 350 { 352 351 /* Add a trailing zero to what we're going to read */ 352 char tmp[7]; 353 353 memcpy(tmp, buffer + i, size - i); 354 354 tmp[size - i] = '\0'; 355 355 ch = cucul_utf8_to_utf32(tmp, &bytes); 356 356 } 357 /* FIXME awful for perfs 358 should get a better way to know if utf8 was valid */ 359 memset(tmp, 0, 7); 360 cucul_utf32_to_utf8(tmp, ch); 361 if(strncmp(tmp, (char const *)(buffer + i), strlen(tmp))) 362 bytes = 0; 357 363 358 if(!bytes) 364 359 { 365 360 /* If the Unicode is invalid, assume it was latin1. */ 366 361 ch = buffer[i]; 367 debug("Invalid UTF-8 : %c", ch);368 362 bytes = 1; 369 363 }
Note: See TracChangeset
for help on using the changeset viewer.