summaryrefslogtreecommitdiff
path: root/src/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/input.c')
-rw-r--r--src/input.c9
1 files changed, 4 insertions, 5 deletions
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];