Re: \b character escapes in CLI usage
- From
Kyle Lippincott <spectral@google.com>
- Date
- Feb 26, 2025, 16:38 UTC
- Message-ID
- <CAO_smVjC=CWeAEjZjr9PPuBTkyYus59o_J9hfnpJCB-AsBE0HA@mail.gmail.com>
- In-Reply-To
- <20250226080902.GA29996@coredump.intra.peff.net>
On Wed, Feb 26, 2025 at 12:09 AM Jeff King <peff@peff.net> wrote:
Show 21 quoted lines
> > On Wed, Feb 26, 2025 at 02:38:23AM -0500, Jeff King wrote: > > > I wonder if we should consider adding "U" to the default $LESS variable > > we set. > > Having tried this for 5 minutes, the answer is a resounding "no". It > also treats tabs as control characters, making source code diffs rather > ugly. ;) > > In modern versions of less you can get around it with: > > LESS="-U --proc-tab" > > or: > > LESS="--PROC-BACKSPACE" > > but those are new in less 632, from the last year or two. So I don't > think we can rely on it in our default variable, but people with recent > versions of less should consider setting it.
From another issue (https://github.com/gwsw/less/issues/557) I learned you can do this:
LESSKEY_CONTENT='#env;#version>=632 LESS=${LESS} --PROC-BACKSPACE'I haven't tested it yet, but that might be a decent solution? I don't know how composable those are; e.g. if you wanted both --PROC-BACKSPACE on >=632 and --no-poll on >=670, I'm *assuming* you can do that, but I don't know what the syntax looks like.
Show 7 quoted lines
> > Looks like it was added for exactly this case: > > https://github.com/gwsw/less/issues/335 > > -Peff >