less icon indicating copy to clipboard operation
less copied to clipboard

8-bit color strings break in a lesskey file.

Open christian-oudard opened this issue 3 years ago • 0 comments

Using Less version 608.

This lesskey file breaks:

#env
LESS = -R --use-color --color=d+1 --color=u+2

It gives the error message Invalid color string "+1 --color=u+2".

This one works as intended, using shortcut option names:

#env
LESS = -R --use-color -Dd+1 -Du+2

But if we put --use-color later in the options, it breaks again:

#env
LESS = -R -Dd+1 -Du+2 --use-color

It also breaks with short options and specifying background color:

#env
LESS = -R --use-color -Dd+1.2 -Du+3.4

From the command line, it works fine with long options (and a blank lesskey file):

less -R --use-color --color=d+1 --color=u+2

It seems the argument parser is not able to tell when the end of the color string is.

christian-oudard avatar Sep 18 '22 17:09 christian-oudard