summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-14 14:42:25 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-14 14:42:25 +0300
commit234dd752dc2e15afab38cbbf78f8aa32be72ea5f (patch)
treedfa79cdfd062953a21f129a9a73a75fdf4dc95b7 /src
parent4be63ed8cd2eb1c4861f0ab287f24ea695fd671e (diff)
Fast-path isolated single ASCII cell printing in term_feed_inner
Diffstat (limited to 'src')
-rw-r--r--src/text.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/text.c b/src/text.c
index 88b23a5..c72ea26 100644
--- a/src/text.c
+++ b/src/text.c
@@ -240,6 +240,19 @@ static void term_feed_inner(struct term *t, const char *buf, size_t len, unsigne
}
}
}
+ if (run == 1) {
+ if (i + 1 < len && (unsigned char)buf[i + 1] >= 0xc2 &&
+ (unsigned char)buf[i + 1] <= 0xf4 &&
+ (i + 2 == len || ((unsigned char)buf[i + 2] & 0xc0) == 0x80)) {
+ uint32_t next_cp;
+ if (utf8_decode_one(buf + i + 1, len - i - 1, &next_cp) &&
+ term_text_class(next_cp) > 0 &&
+ try_text_run(t, buf, len, &i))
+ continue;
+ }
+ sc_print_cell(t, ch, 1, cur_flags);
+ continue;
+ }
if (i + (size_t)run < len && (unsigned char)buf[i + run] >= 0x80) {
uint32_t next_cp;
if (utf8_decode_one(buf + i + run, len - i - (size_t)run, &next_cp) &&