sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

commit 172cdd98c3d34160d6b71991f419caef86c348ca
parent cd9f55f5e1c8035840ecf906665b418db47a56c1
Author: Richard Ipsum <richardipsum@vx21.xyz>
Date:   Fri,  9 Oct 2020 15:52:11 +0100

fold: fix handling of -s

Diffstat:
Mfold.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fold.c b/fold.c @@ -28,14 +28,16 @@ foldline(struct line *l, const char *fname) { eprintf("fwrite <stdout>:"); if (l->data[i] != '\n') putchar('\n'); - last = (sflag && spacesect) ? spacesect : i; + if (sflag && spacesect) + i = spacesect; + last = i; col = 0; spacesect = 0; } runelen = charntorune(&r, l->data + i, l->len - i); if (!runelen || r == Runeerror) eprintf("charntorune: %s: invalid utf\n", fname); - if (sflag && isspacerune(r)) + if (sflag && isblankrune(r)) spacesect = i + runelen; if (!bflag && iscntrl(l->data[i])) { switch(l->data[i]) {