Get variables LESS_TERMCAP_* from lesskey file
The command less skips the variables LESS_TERMCAP_* defined in the lesskey file (e.g. ~/.less).
This is because, the function main() retrieves the variables LESS_TERMCAP_*
before loading of the lesskey file. I propose to just invert two lines.
I explain that in details on this site: https://unix.stackexchange.com/a/377221/13999
This is the current source code at line 110 in main.c
/*
* Process command line arguments and LESS environment arguments.
* Command line arguments override environment arguments.
*/
is_tty = isatty(1);
get_term();
init_cmds();
init_charset();
init_line();
This is the fix I have validated on my computer:
/*
* Process command line arguments and LESS environment arguments.
* Command line arguments override environment arguments.
*/
is_tty = isatty(1);
init_cmds(); /* Load lesskey file before */
get_term(); /* getting variables LESS_TERMCAP_* */
init_charset();
init_line();
I have just inverted two lines: get_term(); and init_cmds();
Questions:
- Do you want a pull request ?
- Do you want to follow the bug-fix from upstream project ?
For information I have sent the same bug report a fix proposal to the less mainteners.
Inverting the two function calls get_term() and init_cmds() has some major regression issues.
The fix is in discussion with @rivy and official maintainer Mark Nudelman (and original author since 34 years).
A good fix should be implemented soon...
Let me know once you've got a good solution to this. Then I'm happy to review a PR.
Hi Garrett. I have successfully tested the beta version as proposed by Mark Nudelman (that version fixes this issue). You will have a new release on http://greenwoodsoftware.com/less/ in the coming months... Mark Nudelman has clean a bit the source code removing, for example, the keyword register as you did. Thank you for your work. Cheers
Thanks. Can I close this PR pending a new one with changes?
Yes you may close this Issue. However I do not have time/motivation to prepare a Pull Request to fix the issue.