summaryrefslogtreecommitdiff
path: root/src/text_run.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/text_run.c')
-rw-r--r--src/text_run.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/text_run.c b/src/text_run.c
index 9df7ac0..bf0e8a9 100644
--- a/src/text_run.c
+++ b/src/text_run.c
@@ -326,11 +326,8 @@ struct text_run_bytes term_text_run_bytes(uint8_t *restrict dst, const char *res
unsigned char c = (unsigned char)buf[i];
if (c >= 0x20 && c < 0x7f) {
int room = max_cols - cx < len - i ? max_cols - cx : len - i;
- int n = 1;
- while (n < room && n < 16 && (unsigned char)(buf[i + n] - 0x20) < 0x5f)
- n++;
- if (n == 16 && n < room)
- n += (int)scan_printable_span(buf + i + 16, (size_t)(room - 16), 0x7f);
+ int n = (int)scan_printable_span(buf + i, (size_t)room, 0x7f);
+ if (!n) n = 1;
bytes_copy_small(dst + o, buf + i, n);
i += n;
o += n;