diff options
| author | Xin LI <delphij@FreeBSD.org> | 2026-02-21 05:33:50 +0000 |
|---|---|---|
| committer | Xin LI <delphij@FreeBSD.org> | 2026-02-21 05:33:50 +0000 |
| commit | e2abec625bf07c054f7ac2df2402d6c454113df8 (patch) | |
| tree | af1fdb79e278ef230b5835197cb73d813d2c1fd0 | |
| parent | e20e26e4e271ecb74e40d9a95ed3112ceaf9604f (diff) | |
| parent | 4be8b0bdecb3af7c801de33f29a6821980840811 (diff) | |
MFV: less v692.
56 files changed, 233 insertions, 99 deletions
diff --git a/contrib/less/LICENSE b/contrib/less/LICENSE index b9b72a3d088b..313cebd4f66f 100644 --- a/contrib/less/LICENSE +++ b/contrib/less/LICENSE @@ -2,7 +2,7 @@ ------------ Less -Copyright (C) 1984-2025 Mark Nudelman +Copyright (C) 1984-2026 Mark Nudelman Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/contrib/less/NEWS b/contrib/less/NEWS index 11022fcb5bf1..0f767aaeb059 100644 --- a/contrib/less/NEWS +++ b/contrib/less/NEWS @@ -11,6 +11,27 @@ ====================================================================== + Major changes between "less" versions 691 and 692 + +* Revert HOME key to scroll to beginning of file and END key + to scroll to end of file (github #658). + +* Configure tty to leave CR and NL unmodified (github #703). + +* Add commands to lesskey parser (forw-bell-hilite, goto-pos and osc8-jump). + +* Add key sequences to lesskey parser (\kE, \kF, \kH, \kI, \kM, and \kS). + +* Fix bug using negative value with -z option (github #709). + +* Fix bug handling empty terminfo capabilties (github #710). + +* Fix memory leak in setupterm (github #707). + +* Make lesstest ignore system locale (nl_langinfo) (github #708). + +====================================================================== + Major changes between "less" versions 685 and 691 * Add --autosave option (github #678). diff --git a/contrib/less/brac.c b/contrib/less/brac.c index 36f31d0316f4..b3b74e07d18a 100644 --- a/contrib/less/brac.c +++ b/contrib/less/brac.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/ch.c b/contrib/less/ch.c index a0796bd5cd63..47d31ecffadd 100644 --- a/contrib/less/ch.c +++ b/contrib/less/ch.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/charset.c b/contrib/less/charset.c index de1c27bdc61e..74159404148b 100644 --- a/contrib/less/charset.c +++ b/contrib/less/charset.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -429,9 +429,18 @@ static void set_charset(void) /* * Try using the codeset name as the charset name. */ - s = nl_langinfo(CODESET); - if (icharset(s, 1)) - return; +#if LESSTEST + /* + * Don't check nl_langinfo in lesstest mode; charset should come + * only from environment variables, not from the system locale. + */ + if (0) /* {{ unfortunately it's too early to use is_lesstest }} */ +#endif + { + s = nl_langinfo(CODESET); + if (icharset(s, 1)) + return; + } #endif #endif diff --git a/contrib/less/charset.h b/contrib/less/charset.h index 4acf494b4ed5..cf2e02547cb5 100644 --- a/contrib/less/charset.h +++ b/contrib/less/charset.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/cmd.h b/contrib/less/cmd.h index 570ab167b2b7..945f99719d0c 100644 --- a/contrib/less/cmd.h +++ b/contrib/less/cmd.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -176,5 +176,7 @@ #define SK_SHIFT_END 35 #define SK_CTL_HOME 36 #define SK_CTL_END 37 +#define SK_SHIFT_LEFT_ARROW 38 +#define SK_SHIFT_RIGHT_ARROW 39 #define SK_CONTROL_K 40 diff --git a/contrib/less/cmdbuf.c b/contrib/less/cmdbuf.c index 6869045f6886..1c3b3d461ad9 100644 --- a/contrib/less/cmdbuf.c +++ b/contrib/less/cmdbuf.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/command.c b/contrib/less/command.c index 4784cf45daa6..1bb8d006f8ec 100644 --- a/contrib/less/command.c +++ b/contrib/less/command.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/cvt.c b/contrib/less/cvt.c index fea9acb8fa71..29b6e06abf40 100644 --- a/contrib/less/cvt.c +++ b/contrib/less/cvt.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/decode.c b/contrib/less/decode.c index e76a111f7b75..3615f5b905d7 100644 --- a/contrib/less/decode.c +++ b/contrib/less/decode.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -102,10 +102,10 @@ static unsigned char cmdtable[] = ESC,'u',0, A_UNDO_SEARCH, ESC,'U',0, A_CLR_SEARCH, 'g',0, A_GOLINE, - SK(SK_HOME),0, A_LLSHIFT, + SK(SK_HOME),0, A_GOLINE, SK(SK_SHIFT_HOME),0, A_GOLINE|A_EXTRA, ESC,'{',0, SK(SK_CTL_HOME),0, A_GOLINE|A_EXTRA, ESC,'{',0, - SK(SK_END),0, A_RRSHIFT, + SK(SK_END),0, A_GOEND, SK(SK_SHIFT_END),0, A_GOEND|A_EXTRA, ESC,'}',0, SK(SK_CTL_END),0, A_GOEND|A_EXTRA, ESC,'}',0, '<',0, A_GOLINE, @@ -120,6 +120,8 @@ static unsigned char cmdtable[] = SK(SK_LEFT_ARROW),0, A_LSHIFT, SK(SK_CTL_RIGHT_ARROW),0, A_RRSHIFT, SK(SK_CTL_LEFT_ARROW),0, A_LLSHIFT, + SK(SK_SHIFT_RIGHT_ARROW),0, A_RRSHIFT, + SK(SK_SHIFT_LEFT_ARROW),0, A_LLSHIFT, '{',0, A_F_BRACKET|A_EXTRA, '{','}',0, '}',0, A_B_BRACKET|A_EXTRA, '{','}',0, '(',0, A_F_BRACKET|A_EXTRA, '(',')',0, @@ -195,8 +197,8 @@ static unsigned char cmdtable[] = SK(SK_PAD_R),0, A_RSHIFT, SK(SK_PAD_L),0, A_LSHIFT, SK(SK_PAD_UR),0, A_B_SCREEN, - SK(SK_PAD_UL),0, A_LLSHIFT, - SK(SK_PAD_DR),0, A_RRSHIFT, + SK(SK_PAD_UL),0, A_GOLINE, + SK(SK_PAD_DR),0, A_F_SCREEN, SK(SK_PAD_DL),0, A_GOEND, SK(SK_PAD_STAR),0, A_NOACTION|A_EXTRA, '*',0, SK(SK_PAD_SLASH),0, A_NOACTION|A_EXTRA, '/',0, @@ -1176,6 +1178,10 @@ static int add_hometable(int (*call_lesskey)(constant char *, lbool), constant c constant char *efilename; int r; +#if LESSTEST + if (is_lesstest()) /* Don't use lesskey files in lesstest */ + return -1; +#endif if (envname != NULL && (efilename = lgetenv(envname)) != NULL) filename = save(efilename); else if (sysvar) /* def_filename is full path */ diff --git a/contrib/less/edit.c b/contrib/less/edit.c index 3a8f4eb41aec..7171b82d15f7 100644 --- a/contrib/less/edit.c +++ b/contrib/less/edit.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/evar.c b/contrib/less/evar.c index d54333954a84..e723fa76527c 100644 --- a/contrib/less/evar.c +++ b/contrib/less/evar.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/filename.c b/contrib/less/filename.c index d9d824be6f50..ad1b4b3cf4a9 100644 --- a/contrib/less/filename.c +++ b/contrib/less/filename.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -475,16 +475,17 @@ public lbool bin_file(int f, ssize_t *n) char data[256]; constant char* p; constant char* edata; + constant int umax = 4; if (!seekable(f)) return FALSE; if (less_lseek(f, (less_off_t)0, SEEK_SET) == BAD_LSEEK) return FALSE; *n = read(f, data, sizeof(data)); - if (*n <= 0) + if (*n <= umax) return FALSE; edata = &data[*n]; - for (p = data; p < edata; ) + for (p = data; p+umax < edata; ) { if (utf_mode && !is_utf8_well_formed(p, (int) ptr_diff(edata,p))) { diff --git a/contrib/less/forwback.c b/contrib/less/forwback.c index 5daf98b7b705..3f21bbffd89f 100644 --- a/contrib/less/forwback.c +++ b/contrib/less/forwback.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/help.c b/contrib/less/help.c index ca6e81fd70f6..52f7a9dc291a 100644 --- a/contrib/less/help.c +++ b/contrib/less/help.c @@ -1,4 +1,4 @@ -/* This file was generated by mkhelp.pl from less.hlp at 16:50 on 2026/1/10 */ +/* This file was generated by mkhelp.pl from less.hlp at 17:46 on 2026/1/29 */ #include "less.h" constant char helpdata[] = { '\n', @@ -69,8 +69,8 @@ constant char helpdata[] = { '\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','J','\b','J','U','\b','U','M','\b','M','P','\b','P','I','\b','I','N','\b','N','G','\b','G','\n', '\n', -' ',' ','g',' ',' ','<',' ',' ','E','S','C','-','<',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','G','o',' ','t','o',' ','f','i','r','s','t',' ','l','i','n','e',' ','i','n',' ','f','i','l','e',' ','(','o','r',' ','l','i','n','e',' ','_','\b','N',')','.','\n', -' ',' ','G',' ',' ','>',' ',' ','E','S','C','-','>',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','G','o',' ','t','o',' ','l','a','s','t',' ','l','i','n','e',' ','i','n',' ','f','i','l','e',' ','(','o','r',' ','l','i','n','e',' ','_','\b','N',')','.','\n', +' ',' ','g',' ',' ','<',' ',' ','E','S','C','-','<',' ',' ','H','O','M','E',' ','*',' ',' ','G','o',' ','t','o',' ','f','i','r','s','t',' ','l','i','n','e',' ','i','n',' ','f','i','l','e',' ','(','o','r',' ','l','i','n','e',' ','_','\b','N',')','.','\n', +' ',' ','G',' ',' ','>',' ',' ','E','S','C','-','>',' ',' ','E','N','D',' ',' ','*',' ',' ','G','o',' ','t','o',' ','l','a','s','t',' ','l','i','n','e',' ','i','n',' ','f','i','l','e',' ','(','o','r',' ','l','i','n','e',' ','_','\b','N',')','.','\n', ' ',' ','p',' ',' ','%',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','G','o',' ','t','o',' ','b','e','g','i','n','n','i','n','g',' ','o','f',' ','f','i','l','e',' ','(','o','r',' ','_','\b','N',' ','p','e','r','c','e','n','t',' ','i','n','t','o',' ','f','i','l','e',')','.','\n', ' ',' ','t',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','G','o',' ','t','o',' ','t','h','e',' ','(','_','\b','N','-','t','h',')',' ','n','e','x','t',' ','t','a','g','.','\n', ' ',' ','T',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','G','o',' ','t','o',' ','t','h','e',' ','(','_','\b','N','-','t','h',')',' ','p','r','e','v','i','o','u','s',' ','t','a','g','.','\n', diff --git a/contrib/less/ifile.c b/contrib/less/ifile.c index 7d516b612e01..f04d0488f966 100644 --- a/contrib/less/ifile.c +++ b/contrib/less/ifile.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/input.c b/contrib/less/input.c index ac9316fe38c0..a3daa0d83827 100644 --- a/contrib/less/input.c +++ b/contrib/less/input.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/jump.c b/contrib/less/jump.c index 472929c5c6af..095f652ef35d 100644 --- a/contrib/less/jump.c +++ b/contrib/less/jump.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/lang.h b/contrib/less/lang.h index 6559c720e98b..e557b101f7cf 100644 --- a/contrib/less/lang.h +++ b/contrib/less/lang.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/less.h b/contrib/less/less.h index 5dd04b6cdcb9..264663e59e51 100644 --- a/contrib/less/less.h +++ b/contrib/less/less.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/less.hlp b/contrib/less/less.hlp index 8fb524936fcd..3bac49d80ff0 100644 --- a/contrib/less/less.hlp +++ b/contrib/less/less.hlp @@ -66,8 +66,8 @@ JJUUMMPPIINNGG - g < ESC-< * Go to first line in file (or line _N). - G > ESC-> * Go to last line in file (or line _N). + g < ESC-< HOME * Go to first line in file (or line _N). + G > ESC-> END * Go to last line in file (or line _N). p % * Go to beginning of file (or _N percent into file). t * Go to the (_N-th) next tag. T * Go to the (_N-th) previous tag. diff --git a/contrib/less/less.nro b/contrib/less/less.nro index 8638df0de5b2..093d9f121e4b 100644 --- a/contrib/less/less.nro +++ b/contrib/less/less.nro @@ -1,5 +1,5 @@ '\" t -.TH LESS 1 "10 Jan 2026" "less 691" +.TH LESS 1 "29 Jan 2026" "less 692" .\" Define a string for the caret ("hat") as portably as possible. .ie \n(.g .ds ^ \(ha .el .ds ^ ^ @@ -171,9 +171,9 @@ Scroll horizontally left N characters, default half the screen width option). If a number N is specified, it becomes the default for future RIGHTARROW and LEFTARROW commands. -.IP "ESC-} or \*^RIGHTARROW or END" +.IP "ESC-} or \*^RIGHTARROW or SHIFT-RIGHTARROW" Scroll horizontally right to show the end of the longest displayed line. -.IP "ESC-{ or \*^LEFTARROW or HOME" +.IP "ESC-{ or \*^LEFTARROW or SHIFT-LEFTARROW" Scroll horizontally left back to the first column. .IP "\*^END or SHIFT-END" Go to line N in the file, default the end of the file, and @@ -213,10 +213,10 @@ the last search pattern, the terminal bell is rung. Like F, but as soon as a line is found which matches the last search pattern, the terminal bell is rung and forward scrolling stops. -.IP "g or < or ESC-<" +.IP "g or < or ESC-< or HOME" Go to line N in the file, default 1 (beginning of file). (Warning: this may be slow if N is large.) -.IP "G or > or ESC->" +.IP "G or > or ESC-> or END" Go to line N in the file, default the end of the file. (Warning: this may be slow if N is large, or if N is not specified and @@ -1624,7 +1624,7 @@ lines less than the current screen size. For example, if the screen is 24 lines, .B "\-z\-4" sets the -scrolling window to 20 lines. If the screen is resized to 40 lines, +scrolling window to 20 lines. If the screen is later resized to 40 lines, the scrolling window automatically changes to 36 lines. .IP "\fB\-""\fP\fIcc\fP\ or\ \fB\-\-quotes=\fP\fIcc\fP" Changes the filename quoting character. @@ -3198,7 +3198,7 @@ Possible location of the history file; see the description of the LESSHISTFILE e .BR lessecho (1) . .SH COPYRIGHT -Copyright (C) 1984-2025 Mark Nudelman +Copyright (C) 1984-2026 Mark Nudelman .PP less is part of the GNU project and is free software. You can redistribute it and/or modify it diff --git a/contrib/less/lessecho.c b/contrib/less/lessecho.c index 2c5a686ed424..3f7c137acf36 100644 --- a/contrib/less/lessecho.c +++ b/contrib/less/lessecho.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/lessecho.nro b/contrib/less/lessecho.nro index 3013644b6a56..c860dd847405 100644 --- a/contrib/less/lessecho.nro +++ b/contrib/less/lessecho.nro @@ -1,4 +1,4 @@ -.TH LESSECHO 1 "10 Jan 2026" "less 691" +.TH LESSECHO 1 "29 Jan 2026" "less 692" .\" Define a string to interpolate the hyphenless break point escape .\" sequence (for URLs and similar) if the formatter claims groff .\" compatibility, else interpolate nothing. diff --git a/contrib/less/lesskey.c b/contrib/less/lesskey.c index 5930056c0dfc..a80870738cc2 100644 --- a/contrib/less/lesskey.c +++ b/contrib/less/lesskey.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/lesskey.h b/contrib/less/lesskey.h index 4d9d1bf280b7..1cf5b6014a6d 100644 --- a/contrib/less/lesskey.h +++ b/contrib/less/lesskey.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/lesskey.nro b/contrib/less/lesskey.nro index b397a6724e59..11f5a306aea8 100644 --- a/contrib/less/lesskey.nro +++ b/contrib/less/lesskey.nro @@ -1,5 +1,5 @@ '\" t -.TH LESSKEY 1 "10 Jan 2026" "less 691" +.TH LESSKEY 1 "29 Jan 2026" "less 692" .\" Define a string for the caret ("hat") as portably as possible. .ie \n(.g .ds ^ \(ha .el .ds ^ ^ @@ -109,17 +109,23 @@ when one of these keys is pressed: .RS 5m .TS l l. -\ekb BACKSPACE (the BACKSPACE key) +\ekb BACKSPACE (the BACKSPACE key; may be different than \eb) \ekB ctrl-BACKSPACE \ekd DOWN ARROW \ekD PAGE DOWN \eke END +\ekE ctrl-END +\ekF shift-END \ekh HOME +\ekH ctrl-HOME +\ekI shift-HOME \eki INSERT \ekl LEFT ARROW \ekL ctrl-LEFT ARROW +\ekM shift-LEFT ARROW \ekr RIGHT ARROW \ekR ctrl-RIGHT ARROW +\ekS shift-RIGHT ARROW \ekt BACKTAB \eku UP ARROW \ekU PAGE UP @@ -199,11 +205,10 @@ y back\-line \*^Y back\-line \*^K back\-line \*^P back\-line +\eku back\-line J forw\-line\-force K back\-line\-force Y back\-line\-force -\eej forw\-newline -\eek back\-newline d forw\-scroll \*^D forw\-scroll u back\-scroll @@ -221,8 +226,11 @@ z forw\-window w back\-window \ee\e40 forw\-screen\-force \eeb back\-screen\-force +\eej forw\-newline +\eek back\-newline F forw\-forever \eeF forw\-until\-hilite +\eef forw\-bell\-hilite R repaint\-flush r repaint \*^R repaint @@ -231,16 +239,25 @@ r repaint \eeU clear\-search g goto\-line \ekh goto\-line +\ekH goto\-line \ee{ +\ekI goto\-line \ee{ +\eke goto\-end +\ekE goto\-end \ee} +\ekF goto\-end \ee} < goto\-line \ee< goto\-line p percent % percent \ee( left\-scroll \ee) right\-scroll -\ekl left\-scroll -\ekr right\-scroll \ee{ no\-scroll \ee} end\-scroll +\ekl left\-scroll +\ekr right\-scroll +\ekL no\-scroll +\ekM no\-scroll +\ekR end\-scroll +\ekS end\-scroll { forw\-bracket {} } back\-bracket {} ( forw\-bracket () @@ -252,7 +269,7 @@ p percent G goto\-end \ee> goto\-end > goto\-end -\eke goto\-end +P goto\-pos \eeG goto\-end\-buffered \&= status \*^G status @@ -265,11 +282,6 @@ n repeat\-search \een repeat\-search\-all N reverse\-search \eeN reverse\-search\-all -\*^O\*^N osc8\-forw\-search -\*^On osc8\-forw\-search -\*^O\*^P osc8\-back\-search -\*^Op osc8\-back\-search -\*^O\*^O osc8\-open & filter m set\-mark M set\-mark\-bottom @@ -281,6 +293,14 @@ E examine \*^X\*^V examine :n next\-file :p prev\-file +\*^O\*^N osc8\-forw\-search +\*^On osc8\-forw\-search +\*^O\*^P osc8\-back\-search +\*^Op osc8\-back\-search +\*^O\*^O osc8\-open +\*^Oo osc8\-open +\*^O\*^L osc8\-jump +\*^Ol osc8\-jump t next\-tag T prev\-tag :x index\-file @@ -292,6 +312,13 @@ s toggle\-option o ## extra string with ONE dash; eg: ## s toggle\-option \-log\-file\en \&_ display\-option +| pipe +v visual +! shell +# pshell ++ firstcmd +\ee[M mouse +\ee[< mouse6 \ekp1 goto\-end \ekp2 forw\-line \ekp3 forw\-screen @@ -307,15 +334,9 @@ s toggle\-option o \ekp+ noaction + \ekp. noaction . \ekp, noaction , -| pipe -v visual -! shell -# pshell -+ firstcmd -\ee[M mouse -\ee[< mouse6 H help h help +\ek1 help V version 0 digit 1 digit @@ -384,6 +405,7 @@ l l. #line\-edit \et forw\-complete \e17 back\-complete +\eekt back\-complete \ee\et back\-complete ^L expand ^V literal @@ -394,14 +416,19 @@ l l. \ekl left \eeb word\-left \ee\ekl word\-left +\ee\ekL word\-left \eew word\-right \ee\ekr word\-right +\ee\ekR word\-right \eei insert +\eki insert \eex delete \ekx delete \eeX word\-delete \eekx word\-delete +\ekX word\-delete \ee\eb word\-backspace +\ekB word\-backspace \ee0 home \ekh home \ee$ end @@ -409,6 +436,7 @@ l l. \eek up \eku up \eej down +\ekd down ^G abort \ekp1 end \ekp2 down @@ -541,7 +569,7 @@ which start with a NUL character (0). This NUL character should be represented as \e340 in a lesskey file. . .SH COPYRIGHT -Copyright (C) 1984-2025 Mark Nudelman +Copyright (C) 1984-2026 Mark Nudelman .PP less is part of the GNU project and is free software. You can redistribute it and/or modify it diff --git a/contrib/less/lesskey_parse.c b/contrib/less/lesskey_parse.c index d844be960817..d19ae26dffdf 100644 --- a/contrib/less/lesskey_parse.c +++ b/contrib/less/lesskey_parse.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -53,6 +53,7 @@ static constant struct lesskey_cmdname cmdnames[] = { "first-cmd", A_FIRSTCMD }, { "firstcmd", A_FIRSTCMD }, { "flush-repaint", A_FREPAINT }, + { "forw-bell-hilite", A_F_FOREVER_BELL }, { "forw-bracket", A_F_BRACKET }, { "forw-forever", A_F_FOREVER }, { "forw-line", A_F_LINE }, @@ -68,6 +69,7 @@ static constant struct lesskey_cmdname cmdnames[] = { "goto-end-buffered", A_GOEND_BUF }, { "goto-line", A_GOLINE }, { "goto-mark", A_GOMARK }, + { "goto-pos", A_GOPOS }, { "help", A_HELP }, { "index-file", A_INDEX_FILE }, { "invalid", A_UINVALID }, @@ -80,6 +82,7 @@ static constant struct lesskey_cmdname cmdnames[] = { "noaction", A_NOACTION }, { "osc8-forw-search", A_OSC8_F_SEARCH }, { "osc8-back-search", A_OSC8_B_SEARCH }, + { "osc8-jump", A_OSC8_JUMP }, { "osc8-open", A_OSC8_OPEN }, { "percent", A_PERCENT }, { "pipe", A_PIPE }, @@ -255,12 +258,18 @@ static constant char * tstr(char **pp, int xlate) case 'd': ch = SK_DOWN_ARROW; break; case 'D': ch = SK_PAGE_DOWN; break; case 'e': ch = SK_END; break; + case 'E': ch = SK_CTL_END; break; + case 'F': ch = SK_SHIFT_END; break; case 'h': ch = SK_HOME; break; + case 'H': ch = SK_CTL_HOME; break; + case 'I': ch = SK_SHIFT_HOME; break; case 'i': ch = SK_INSERT; break; case 'l': ch = SK_LEFT_ARROW; break; case 'L': ch = SK_CTL_LEFT_ARROW; break; + case 'M': ch = SK_SHIFT_LEFT_ARROW; break; case 'r': ch = SK_RIGHT_ARROW; break; case 'R': ch = SK_CTL_RIGHT_ARROW; break; + case 'S': ch = SK_SHIFT_RIGHT_ARROW; break; case 't': ch = SK_BACKTAB; break; case 'u': ch = SK_UP_ARROW; break; case 'U': ch = SK_PAGE_UP; break; diff --git a/contrib/less/lglob.h b/contrib/less/lglob.h index af261fb2cfdd..1253e09a554a 100644 --- a/contrib/less/lglob.h +++ b/contrib/less/lglob.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/line.c b/contrib/less/line.c index e554fce69fa9..25ff641774b9 100644 --- a/contrib/less/line.c +++ b/contrib/less/line.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/linenum.c b/contrib/less/linenum.c index 0f7e7cdf6275..b8386f1fca09 100644 --- a/contrib/less/linenum.c +++ b/contrib/less/linenum.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/lsystem.c b/contrib/less/lsystem.c index 0d55241eae85..63c0cf074524 100644 --- a/contrib/less/lsystem.c +++ b/contrib/less/lsystem.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/main.c b/contrib/less/main.c index 312c19af28e1..3adc06dc1cd1 100644 --- a/contrib/less/main.c +++ b/contrib/less/main.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/mark.c b/contrib/less/mark.c index b15ff0f12a9d..7813429ce58a 100644 --- a/contrib/less/mark.c +++ b/contrib/less/mark.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/optfunc.c b/contrib/less/optfunc.c index 29d2748bc935..2370103349a0 100644 --- a/contrib/less/optfunc.c +++ b/contrib/less/optfunc.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -556,7 +556,7 @@ public void opt__V(int type, constant char *s) putstr(" regular expressions)\n"); { char constant *copyright = - "Copyright (C) 1984-2025 Mark Nudelman\n\n"; + "Copyright (C) 1984-2026 Mark Nudelman\n\n"; putstr(copyright); } if (version[strlen(version)-1] == 'x') diff --git a/contrib/less/option.c b/contrib/less/option.c index 77ab1b305cdf..ff55647958d0 100644 --- a/contrib/less/option.c +++ b/contrib/less/option.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -93,7 +93,7 @@ public void scan_option(constant char *s, lbool is_env) break; case O_NUMBER: printopt = opt_desc(pendopt); - getnumc(&s, printopt, FALSE, pendopt->ovar); + getnumc(&s, printopt, (pendopt->otype & O_NEGOK) != 0, pendopt->ovar); break; } } @@ -295,7 +295,7 @@ public void scan_option(constant char *s, lbool is_env) } if (o->otype & O_UNSUPPORTED) break; - getnumc(&s, printopt, FALSE, o->ovar); + getnumc(&s, printopt, (o->otype & O_NEGOK) != 0, o->ovar); break; } /* @@ -437,7 +437,7 @@ public lbool toggle_option(struct loption *o, lbool lower, constant char *s, int switch (how_toggle) { case OPT_TOGGLE: - if (!getnumc(&s, opt_desc(o), FALSE, o->ovar)) + if (!getnumc(&s, opt_desc(o), (o->otype & O_NEGOK) != 0, o->ovar)) return FALSE; break; case OPT_UNSET: diff --git a/contrib/less/option.h b/contrib/less/option.h index 5c0a69b716f1..a5daf7e26a62 100644 --- a/contrib/less/option.h +++ b/contrib/less/option.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -24,6 +24,7 @@ #define O_NO_QUERY 0400 /* Option cannot be queried with "_" cmd */ #define O_INIT_HANDLER 01000 /* Call option handler function at startup */ #define O_UNSUPPORTED 02000 /* Option is unsupported via LESS_UNSUPPORT */ +#define O_NEGOK 04000 /* O_NUMBER parameter may be negative */ #define OTYPE (O_BOOL|O_TRIPLE|O_NUMBER|O_STRING|O_NOVAR) diff --git a/contrib/less/opttbl.c b/contrib/less/opttbl.c index cf790125a976..5f9b102d934b 100644 --- a/contrib/less/opttbl.c +++ b/contrib/less/opttbl.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -472,7 +472,7 @@ static struct loption option[] = } }, { 'z', &z_optname, - O_NUMBER, -1, &swindow, NULL, + O_NUMBER|O_NEGOK, -1, &swindow, NULL, { "Scroll window size: ", "Scroll window size is %d lines", diff --git a/contrib/less/os.c b/contrib/less/os.c index 208a9724e362..06ebce12eb96 100644 --- a/contrib/less/os.c +++ b/contrib/less/os.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/output.c b/contrib/less/output.c index 57c54eebe160..14627f65c900 100644 --- a/contrib/less/output.c +++ b/contrib/less/output.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/pattern.c b/contrib/less/pattern.c index 0c72b98d2cd1..228c89b49fcc 100644 --- a/contrib/less/pattern.c +++ b/contrib/less/pattern.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/pattern.h b/contrib/less/pattern.h index 79122e843f17..3f7caf3d4b9e 100644 --- a/contrib/less/pattern.h +++ b/contrib/less/pattern.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/pckeys.h b/contrib/less/pckeys.h index 335863511b08..5ee70807c7bd 100644 --- a/contrib/less/pckeys.h +++ b/contrib/less/pckeys.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -36,3 +36,5 @@ #define PCK_CTL_HOME '\x7a' #define PCK_CTL_END '\x7c' #define PCK_SHIFT_HOME '\x7d' +#define PCK_SHIFT_LEFT '\x73' +#define PCK_SHIFT_RIGHT '\x7f' diff --git a/contrib/less/position.c b/contrib/less/position.c index 3de034c17af4..442e6c929f6f 100644 --- a/contrib/less/position.c +++ b/contrib/less/position.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/position.h b/contrib/less/position.h index 609967aa1094..478ac2279015 100644 --- a/contrib/less/position.h +++ b/contrib/less/position.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/prompt.c b/contrib/less/prompt.c index b37d09a346a8..3ab8a593877c 100644 --- a/contrib/less/prompt.c +++ b/contrib/less/prompt.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/screen.c b/contrib/less/screen.c index ee75503fc780..4c95f985daf5 100644 --- a/contrib/less/screen.c +++ b/contrib/less/screen.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -369,6 +369,15 @@ static void set_termio_flags( | ONLRET #endif ); + + s->c_iflag &= ~(0 +#ifdef ICRNL + | ICRNL +#endif +#ifdef INLCR + | INLCR +#endif + ); } #endif @@ -381,7 +390,7 @@ static void set_termio_flags( * 4. \t is NOT expanded into spaces. * 5. Signal-causing characters such as ctrl-C (interrupt), * etc. are NOT disabled. - * It doesn't matter whether an input \n is mapped to \r, or vice versa. + * 6. Input \r is not mapped to \n, nor vice versa. */ public void raw_mode(int on) { @@ -897,7 +906,7 @@ public void scrsize(void) #ifdef TIOCGWINSZ { struct winsize w; - if (ioctl(2, TIOCGWINSZ, &w) == 0) + if (ioctl(2, TIOCGWINSZ, &w) == 0 || ioctl(1, TIOCGWINSZ, &w) == 0) { if (w.ws_row > 0) sys_height = w.ws_row; @@ -909,7 +918,7 @@ public void scrsize(void) #ifdef WIOCGETD { struct uwdata w; - if (ioctl(2, WIOCGETD, &w) == 0) + if (ioctl(2, WIOCGETD, &w) == 0 || ioctl(1, WIOCGETD, &w) == 0) { if (w.uw_height > 0) sys_height = w.uw_height / w.uw_vs; @@ -1030,6 +1039,8 @@ public constant char * special_key_str(int key) static char k_left[] = { '\340', PCK_LEFT, 0 }; static char k_ctl_right[] = { '\340', PCK_CTL_RIGHT, 0 }; static char k_ctl_left[] = { '\340', PCK_CTL_LEFT, 0 }; + static char k_shift_right[] = { '\340', PCK_SHIFT_RIGHT, 0 }; + static char k_shift_left[] = { '\340', PCK_SHIFT_LEFT, 0 }; static char k_insert[] = { '\340', PCK_INSERT, 0 }; static char k_delete[] = { '\340', PCK_DELETE, 0 }; static char k_ctl_delete[] = { '\340', PCK_CTL_DELETE, 0 }; @@ -1135,6 +1146,12 @@ public constant char * special_key_str(int key) case SK_CTL_RIGHT_ARROW: s = k_ctl_right; break; + case SK_SHIFT_LEFT_ARROW: + s = k_shift_left; + break; + case SK_SHIFT_RIGHT_ARROW: + s = k_shift_right; + break; case SK_CTL_BACKSPACE: s = k_ctl_backspace; break; @@ -1205,6 +1222,12 @@ public constant char * special_key_str(int key) case SK_BACKTAB: s = ltgetstr("kcbt", "kB", &sp); break; + case SK_SHIFT_RIGHT_ARROW: + s = ltgetstr("kRIT", NULL, &sp); + break; + case SK_SHIFT_LEFT_ARROW: + s = ltgetstr("kLFT", NULL, &sp); + break; case SK_CTL_RIGHT_ARROW: s = ltgetstr("kRIT5", NULL, &sp); break; @@ -1289,6 +1312,8 @@ public constant char * special_key_str(int key) default: return (NULL); } + if (s != NULL && *s == '\0') + s = NULL; return (s); } @@ -1418,6 +1443,8 @@ public void get_term() term = DEFAULT_TERM; hardcopy = 0; #if USE_TERMINFO + if (cur_term != NULL) + del_curterm(cur_term); if (setupterm(term, -1, NULL) != OK) hardcopy = 1; #else @@ -3300,6 +3327,12 @@ static lbool win32_scan_code(XINPUT_RECORD *xip) { switch (xip->ir.Event.KeyEvent.wVirtualScanCode) { + case PCK_RIGHT: + scan = PCK_SHIFT_RIGHT; + break; + case PCK_LEFT: + scan = PCK_SHIFT_LEFT; + break; case PCK_HOME: scan = PCK_SHIFT_HOME; break; diff --git a/contrib/less/scrsize.c b/contrib/less/scrsize.c index 66e87161e914..fb3e28826d04 100644 --- a/contrib/less/scrsize.c +++ b/contrib/less/scrsize.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/search.c b/contrib/less/search.c index 68122f163964..0b949f2234e9 100644 --- a/contrib/less/search.c +++ b/contrib/less/search.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/signal.c b/contrib/less/signal.c index b4df6c7daeda..f65a25ad2e0b 100644 --- a/contrib/less/signal.c +++ b/contrib/less/signal.c @@ -1,6 +1,6 @@ #include <errno.h> /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/tags.c b/contrib/less/tags.c index e707a618d214..7f5d1b2976cd 100644 --- a/contrib/less/tags.c +++ b/contrib/less/tags.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/ttyin.c b/contrib/less/ttyin.c index f3411cf1dd56..678324a5090c 100644 --- a/contrib/less/ttyin.c +++ b/contrib/less/ttyin.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/contrib/less/version.c b/contrib/less/version.c index 9d7fa034d78c..b3d83c1ca2fc 100644 --- a/contrib/less/version.c +++ b/contrib/less/version.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2025 Mark Nudelman + * Copyright (C) 1984-2026 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -1074,6 +1074,10 @@ v689 12/27/25 Add prompt seqs %C, %W, %Q, ?Q; don't allow any command to add --without-termlib. v690 12/31/25 Cleanup. v691 1/10/26 Fix mingw build. +v692 1/29/26 Fix memory leak in setupterm; clear termio ICRNL|INLCR; + fix bug with negative value in -z; fix bug with empty + terminfo caps; make lesstest ignore nl_langinfo; + revert HOME/END to g/G; add keys & cmds to lesskey parser. */ -char version[] = "691"; +char version[] = "692"; diff --git a/contrib/less/xbuf.c b/contrib/less/xbuf.c index 89ef2fafeccd..55b97530d462 100644 --- a/contrib/less/xbuf.c +++ b/contrib/less/xbuf.c @@ -1,3 +1,12 @@ +/* + * Copyright (C) 1984-2026 Mark Nudelman + * + * You may distribute under the terms of either the GNU General Public + * License or the Less License, as specified in the README file. + * + * For more information, see the README file. + */ + #include "less.h" #include "xbuf.h" diff --git a/contrib/less/xbuf.h b/contrib/less/xbuf.h index 79e6453c3215..39508a64f51a 100644 --- a/contrib/less/xbuf.h +++ b/contrib/less/xbuf.h @@ -1,3 +1,12 @@ +/* + * Copyright (C) 1984-2026 Mark Nudelman + * + * You may distribute under the terms of either the GNU General Public + * License or the Less License, as specified in the README file. + * + * For more information, see the README file. + */ + #ifndef XBUF_H_ #define XBUF_H_ |
