Re: [hackers] [sbase][PATCH 2/5] fold: fix handling of \b

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

On 2020-06-20, Richard Ipsum <richardipsum_AT_vx21.xyz> wrote:
> diff --git a/fold.c b/fold.c
> index 9c3c919..a54594b 100644
> --- a/fold.c
> +++ b/fold.c
> _AT_@ -19,7 +19,7 @@ foldline(struct line *l) {
> for (i = 0, last = 0, col = 0, spacesect = 0; i < l->len; i++) {
> if (!UTF8_POINT(l->data[i]) && !bflag)
> continue;
> - if (col >= width) {
> + if (col >= width && (l->data[i] != '\b' || bflag)) {

I think '\r' might also need special handling here.

> len = ((sflag && spacesect) ? spacesect : i) - last;
> if (fwrite(l->data + last, 1, len, stdout) != len)
> eprintf("fwrite <stdout>:");
Received on Thu Oct 01 2020 - 07:27:53 CEST

This archive was generated by hypermail 2.3.0 : Thu Oct 01 2020 - 08:36:32 CEST