fold: fix handling of \b,\r
This commit is contained in:
parent
75b5499a3a
commit
0d42b4f3d1
2
fold.c
2
fold.c
@ -19,7 +19,7 @@ foldline(struct line *l) {
|
|||||||
for (i = 0, last = 0, col = 0, spacesect = 0; i < l->len; i++) {
|
for (i = 0, last = 0, col = 0, spacesect = 0; i < l->len; i++) {
|
||||||
if (!UTF8_POINT(l->data[i]) && !bflag)
|
if (!UTF8_POINT(l->data[i]) && !bflag)
|
||||||
continue;
|
continue;
|
||||||
if (col >= width) {
|
if (col >= width && ((l->data[i] != '\r' && l->data[i] != '\b') || bflag)) {
|
||||||
len = ((sflag && spacesect) ? spacesect : i) - last;
|
len = ((sflag && spacesect) ? spacesect : i) - last;
|
||||||
if (fwrite(l->data + last, 1, len, stdout) != len)
|
if (fwrite(l->data + last, 1, len, stdout) != len)
|
||||||
eprintf("fwrite <stdout>:");
|
eprintf("fwrite <stdout>:");
|
||||||
|
Loading…
Reference in New Issue
Block a user