[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH 2/2] less: replace most uses of NORMAL escape with UNHIGHLIGHT
From:       Ishan Bhargava <shane.880088.supw () gmail ! com>
Date:       2022-04-15 5:50:20
Message-ID: CA+hMe=irQ3Y4vKNfMna4mj0MnwGQHpLWPMYzwr4_SyEp8EN0PA () mail ! gmail ! com
[Download RAW message or body]

On Fri, 15 Apr 2022 at 05:49, Kang-Che Sung <explorer09@gmail.com> wrote:
> What's the difference between the NORMAL escape and the UNHIGHLIGHT escape? Is \
> there a test case to demonstrate th>

The UNHIGHLIGHT escape flips only the HIGHLIGHT (invert, actually) bit back to
off. The normal escape flips ALL special display bits back to off, including
color. We don't want that in case there is a highlighted term (e.g. another
control sequence) in between a colored line.

test case:
printf '\033[33mhello\033\007\013hi\033[m' > ./tmp

Compare how busybox less without this 2nd patch vs. greenwood less (and bbless
with this patch) shows the output. In the former, the colored line is just cut
short because of the highlighted control chars. In the latter, the entire line
is colored, with small highlighted (colored) sections in between.

One thing this cannot deal with is a highlight escape in the input itself,
which would be cut short by any less-emmitted highlight sequence. Avoiding that
would probably require looking at the escapes and keeping state.
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic