MFV: less v692.

This commit is contained in:
Xin LI
2026-02-20 21:33:50 -08:00
56 changed files with 233 additions and 99 deletions
+1 -1
View File
@@ -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
+21
View File
@@ -9,6 +9,27 @@
Report bugs, suggestions or comments at
https://github.com/gwsw/less/issues.
======================================================================
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
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+13 -4
View File
@@ -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
+1 -1
View File
@@ -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.
+3 -1
View File
@@ -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
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+11 -5
View File
@@ -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 */
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+4 -3
View File
@@ -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)))
{
+1 -1
View File
@@ -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.
+3 -3
View File
@@ -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',
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+2 -2
View File
@@ -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.
+7 -7
View File
@@ -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
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+48 -20
View File
@@ -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
+10 -1
View File
@@ -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;
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+2 -2
View File
@@ -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')
+4 -4
View File
@@ -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:
+2 -1
View File
@@ -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)
+2 -2
View File
@@ -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",
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+3 -1
View File
@@ -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'
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+37 -4
View File
@@ -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.
@@ -367,6 +367,15 @@ static void set_termio_flags(
#endif
#ifdef ONLRET
| ONLRET
#endif
);
s->c_iflag &= ~(0
#ifdef ICRNL
| ICRNL
#endif
#ifdef INLCR
| INLCR
#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;
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+6 -2
View File
@@ -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";
+9
View File
@@ -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"
+9
View File
@@ -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_