fold: fix handling of -s
This commit is contained in:
parent
cd9f55f5e1
commit
172cdd98c3
6
fold.c
6
fold.c
@ -28,14 +28,16 @@ foldline(struct line *l, const char *fname) {
|
|||||||
eprintf("fwrite <stdout>:");
|
eprintf("fwrite <stdout>:");
|
||||||
if (l->data[i] != '\n')
|
if (l->data[i] != '\n')
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
last = (sflag && spacesect) ? spacesect : i;
|
if (sflag && spacesect)
|
||||||
|
i = spacesect;
|
||||||
|
last = i;
|
||||||
col = 0;
|
col = 0;
|
||||||
spacesect = 0;
|
spacesect = 0;
|
||||||
}
|
}
|
||||||
runelen = charntorune(&r, l->data + i, l->len - i);
|
runelen = charntorune(&r, l->data + i, l->len - i);
|
||||||
if (!runelen || r == Runeerror)
|
if (!runelen || r == Runeerror)
|
||||||
eprintf("charntorune: %s: invalid utf\n", fname);
|
eprintf("charntorune: %s: invalid utf\n", fname);
|
||||||
if (sflag && isspacerune(r))
|
if (sflag && isblankrune(r))
|
||||||
spacesect = i + runelen;
|
spacesect = i + runelen;
|
||||||
if (!bflag && iscntrl(l->data[i])) {
|
if (!bflag && iscntrl(l->data[i])) {
|
||||||
switch(l->data[i]) {
|
switch(l->data[i]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user