commit 0d42b4f3d14bc2a4bf87e25d464772b9c8222ed0
parent 75b5499a3a9caa4b81214f82c3f0b5322376f918
Author: Richard Ipsum <richardipsum@vx21.xyz>
Date: Fri, 9 Oct 2020 15:52:08 +0100
fold: fix handling of \b,\r
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fold.c b/fold.c
@@ -19,7 +19,7 @@ foldline(struct line *l) {
for (i = 0, last = 0, col = 0, spacesect = 0; i < l->len; i++) {
if (!UTF8_POINT(l->data[i]) && !bflag)
continue;
- if (col >= width) {
+ if (col >= width && ((l->data[i] != '\r' && l->data[i] != '\b') || bflag)) {
len = ((sflag && spacesect) ? spacesect : i) - last;
if (fwrite(l->data + last, 1, len, stdout) != len)
eprintf("fwrite <stdout>:");