Index | Thread | Search

From:
YASUOKA Masahiko <yasuoka@openbsd.org>
Subject:
Re: watch: tab + holizontal scroll
To:
tedu@tedunangst.com
Cc:
job@openbsd.org, tech@openbsd.org
Date:
Sat, 28 Jun 2025 21:08:25 +0900

Download raw body.

Thread
On Fri, 27 Jun 2025 13:35:46 -0400
"Ted Unangst" <tedu@tedunangst.com> wrote:
> On 2025-06-27, Ted Unangst wrote:
>> On 2025-06-27, YASUOKA Masahiko wrote:
>> > Hi,
>> > 
>> > More care about TAB spaces seems to be needed for scrolling
>> > horizontally.
>> 
>> This isn't quite right. I ran watch cat tabs.txt.
> 
> I think the fix is simple if we do it in child_input.
> 
> Does this work for you?

Yes.  The diff is much simpler.

ok yasuoka

Also I'll patially revert the previous commit, 1.31.

> Index: watch.c
> ===================================================================
> RCS file: /home/cvs/src/usr.bin/watch/watch.c,v
> diff -u -p -r1.32 watch.c
> --- watch.c	26 Jun 2025 21:34:45 -0000	1.32
> +++ watch.c	27 Jun 2025 17:33:37 -0000
> @@ -544,6 +544,13 @@ child_input(int sig, short event, void *
>  		}
>  		if (c == MAXCOLUMN)
>  			continue;
> +		if (wc == '\t') {
> +			(*buf)[l][c++] = ' ';
> +			while (c & 7 && c < MAXCOLUMN)
> +				(*buf)[l][c++] = ' ';
> +			continue;
> +		}
> +
>  		(*buf)[l][c++] = wc;
>  	}
>  	display(buf, prev_buf, highlight_mode);
> 
>