mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-22 21:01:24 +03:00
tweaks: use knowledge of Unicode to skip the general multibyte conversion
The relevant range is so small (128 bytes) that "manual" conversion is much faster (and a bit shorter, eliding two variables).
This commit is contained in:
parent
17a8b24fe5
commit
43b39ed04f
19
src/winio.c
19
src/winio.c
@ -995,21 +995,20 @@ int parse_kbinput(WINDOW *win)
|
|||||||
return ERR;
|
return ERR;
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
else if (byte > 0x7F && using_utf8()) {
|
else if (byte > 0x7F && using_utf8()) {
|
||||||
int count;
|
/* Convert the code to the corresponding Unicode. */
|
||||||
/* Convert the decimal code to two bytes. */
|
if (byte < 0xC0) {
|
||||||
char *multibyte = make_mbchar((long)byte, &count);
|
put_back((unsigned char)byte);
|
||||||
|
put_back(0xC2);
|
||||||
/* Insert the two bytes into the input buffer. */
|
} else {
|
||||||
put_back((unsigned char)multibyte[1]);
|
put_back((unsigned char)(byte - 0x40));
|
||||||
put_back((unsigned char)multibyte[0]);
|
put_back(0xC3);
|
||||||
|
}
|
||||||
free(multibyte);
|
|
||||||
escapes = 0;
|
escapes = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
|
retval = byte;
|
||||||
escapes = 0;
|
escapes = 0;
|
||||||
return byte;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (digit_count > 0)
|
if (digit_count > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user