[hackers] [sbase] fold: fix handling of -s || Richard Ipsum

From: <git_AT_suckless.org>
Date: Thu, 15 Oct 2020 00:24:17 +0200 (CEST)

commit 172cdd98c3d34160d6b71991f419caef86c348ca
Author: Richard Ipsum <richardipsum_AT_vx21.xyz>
AuthorDate: Fri Oct 9 15:52:11 2020 +0100
Commit: Michael Forney <mforney_AT_mforney.org>
CommitDate: Wed Oct 14 15:03:20 2020 -0700

    fold: fix handling of -s

diff --git a/fold.c b/fold.c
index c7f6ae8..6c7b9e7 100644
--- a/fold.c
+++ b/fold.c
_AT_@ -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]) {
Received on Thu Oct 15 2020 - 00:24:17 CEST

This archive was generated by hypermail 2.3.0 : Thu Oct 15 2020 - 00:36:34 CEST