fold: fix handling of \b,\r

This commit is contained in:
Richard Ipsum 2020-10-09 15:52:08 +01:00 committed by Michael Forney
parent 75b5499a3a
commit 0d42b4f3d1
1 changed files with 1 additions and 1 deletions

2
fold.c
View File

@ -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>:");