commit 0d42b4f3d14bc2a4bf87e25d464772b9c8222ed0
Author:     Richard Ipsum <[email protected]>
AuthorDate: Fri Oct 9 15:52:08 2020 +0100
Commit:     Michael Forney <[email protected]>
CommitDate: Wed Oct 14 15:03:20 2020 -0700

    fold: fix handling of \b,\r

diff --git a/fold.c b/fold.c
index 9c3c919..dfce7c8 100644
--- 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>:");

Reply via email to