mirror of
git://git.sv.gnu.org/nano.git
synced 2025-01-24 02:02:45 +03:00
tweaks: reorder some code, to further optimize display_string() for ASCII
The majority of characters in the files that get edited with nano will be single-byte printable ASCII characters, so their case should come first in the main loop of display_string().
This commit is contained in:
parent
5c4b0b38f4
commit
ed40fd8031
14
src/winio.c
14
src/winio.c
@ -1924,6 +1924,13 @@ char *display_string(const char *buf, size_t column, size_t span,
|
||||
while (*buf != '\0' && (column < beyond || mbwidth(buf) == 0)) {
|
||||
int charlength, charwidth;
|
||||
|
||||
/* A plain printable ASCII character is one byte, one column. */
|
||||
if ((signed char)*buf > 0x20 && *buf != DEL_CODE) {
|
||||
converted[index++] = *(buf++);
|
||||
column++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Show a space as a visible character, or as a space. */
|
||||
if (*buf == ' ') {
|
||||
#ifndef NANO_TINY
|
||||
@ -1968,13 +1975,6 @@ char *display_string(const char *buf, size_t column, size_t span,
|
||||
continue;
|
||||
}
|
||||
|
||||
/* A normal, one-byte character is necessarily one column wide. */
|
||||
if ((signed char)*buf > 0) {
|
||||
converted[index++] = *(buf++);
|
||||
column++;
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
wchar_t wc;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user