Re: [hackers] [sbase][PATCH 5/5] fold: fix handling of -s

From: Michael Forney <mforney_AT_mforney.org>
Date: Wed, 30 Sep 2020 22:49:55 -0700

On 2020-06-20, Richard Ipsum <richardipsum_AT_vx21.xyz> wrote:
> diff --git a/fold.c b/fold.c
> index 169064b..10a23cf 100644
> --- a/fold.c
> +++ b/fold.c
> _AT_@ -29,12 +29,14 @@ foldline(struct line *l) {
> 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 = chartorune(&r, l->data + i);
> - if (sflag && isspace(l->data[i]))
> + if (sflag && isblankrune(r))

It seems like this hunk might belong better with patch 4/5? Or maybe
4/5 should use isspacerune, and change it to isblankrune here.

> spacesect = i + 1;

I think this should be `i + runelen` in case there is a multibyte blank.

> if (!bflag && iscntrl(l->data[i])) {
> switch(l->data[i]) {
Received on Thu Oct 01 2020 - 07:49:55 CEST

This archive was generated by hypermail 2.3.0 : Thu Oct 01 2020 - 13:24:32 CEST