From 1b52f704a005d79d00b1260b1e5bc5d6798ff7b6 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Tue, 13 Oct 2026 19:41:47 +0300 Subject: Replace scalar loops with SIMD spans, packed stores, and direct wrap-pad checks --- src/input.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/input.c') diff --git a/src/input.c b/src/input.c index 798ffc0..960f488 100644 --- a/src/input.c +++ b/src/input.c @@ -716,11 +716,10 @@ struct term_input_result term_input_encode_paste(const struct term_modes *m, size_t body = sb_len(&sb, buf); for (size_t i = 0; i < len;) { if (sb.overflow) break; - size_t start = i; - while (i < len && (unsigned char)text[i] >= 0x20 && (unsigned char)text[i] < 0x7f) - i++; - if (i > start) { - sb_bytes(&sb, text + start, i - start); + size_t run = term_scan_printable_span(text + i, len - i, 0x7f); + if (run > 0) { + sb_bytes(&sb, text + i, run); + i += run; continue; } unsigned char c = (unsigned char)text[i]; -- cgit v1.2.3