------------
Less
-Copyright (C) 1984-2015 Mark Nudelman
+Copyright (C) 1984-2016 Mark Nudelman
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
ubin.uni: unicode/UnicodeData.txt
./mkutable -f2 Cc Cf Cs Co Zl Zp -- unicode/UnicodeData.txt > $@
wide.uni: unicode/EastAsianWidth.txt
- ./mkutable -f1 W -- unicode/EastAsianWidth.txt > $@
+ ./mkutable -f1 W F -- unicode/EastAsianWidth.txt > $@
distfiles: ${DISTFILES}
# This rule allows us to supply the necessary -D options
# in addition to whatever the user asks for.
-.c.obj:
+.c.obj::
$(CC) $(CFLAGS) $<
OBJ = \
all: less.exe lesskey.exe
-# This is really horrible, but the command line is too long for
-# MS-DOS if we try to link ${OBJ}.
less.exe: $(OBJ)
- -del lesskey.obj
- $(LD) $(LDFLAGS) *.obj $(LIBS) /out:$@
+ $(LD) $(LDFLAGS) $** $(LIBS) /out:$@
lesskey.exe: lesskey.obj version.obj
$(LD) $(LDFLAGS) lesskey.obj version.obj $(LIBS) /out:$@
======================================================================
+ Major changes between "less" versions 481 and 487
+
+* New commands ESC-{ and ESC-} to shift to start/end of displayed lines.
+
+* Make search highlights work correctly when changing caselessness with -i.
+
+* New option -Da in Windows version to enable SGR mode.
+
+* Fix "nothing to search" error when top or bottom line on screen is empty.
+
+* Fix bug when terminal has no "cm" termcap entry.
+
+* Fix incorrect display when entering double-width chars in search string.
+
+* Fix bug in Unicode handling that missed some double width characters.
+
+* Update Unicode database to 9.0.0.
+
+======================================================================
+
Major changes between "less" versions 458 and 481
* Don't overwrite history file; just append to it.
- Less, version 481
+ Less, version 487
- This is the distribution of less, version 481, released 31 Aug 2015.
+ This is the distribution of less, version 487, released 25 Oct 2016.
This program is part of the GNU project (http://www.gnu.org).
This program is free software. You may redistribute it and/or
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
char *oname;
} cs_aliases[] = {
{ "UTF-8", "utf-8" },
+ { "utf8", "utf-8" },
+ { "UTF8", "utf-8" },
{ "ANSI_X3.4-1968", "ascii" },
{ "US-ASCII", "ascii" },
{ "latin1", "iso8859" },
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
#define A_FILTER 55
#define A_F_UNTIL_HILITE 56
#define A_GOEND_BUF 57
+#define A_LLSHIFT 58
+#define A_RRSHIFT 59
#define A_INVALID 100
#define A_NOACTION 101
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
while (*s != '\0')
{
char *ns = s;
+ int width;
ch = step_char(&ns, +1, endline);
while (s < ns)
putchr(*s++);
if (!utf_mode)
- {
- cmd_col++;
- prompt_col++;
- } else if (!is_composing_char(ch) &&
- !is_combining_char(prev_ch, ch))
- {
- int width = is_wide_char(ch) ? 2 : 1;
- cmd_col += width;
- prompt_col += width;
- }
+ width = 1;
+ else if (is_composing_char(ch) || is_combining_char(prev_ch, ch))
+ width = 0;
+ else
+ width = is_wide_char(ch) ? 2 : 1;
+ cmd_col += width;
+ prompt_col += width;
prev_ch = ch;
}
}
/*
* Common part of cmd_step_right() and cmd_step_left().
+ * {{ Returning pwidth and bswidth separately is a historical artifact
+ * since they're always the same. Maybe clean this up someday. }}
*/
static char *
cmd_step_common(p, ch, len, pwidth, bswidth)
int *bswidth;
{
char *pr;
+ int width;
if (len == 1)
{
pr = prchar((int) ch);
- if (pwidth != NULL || bswidth != NULL)
- {
- int len = (int) strlen(pr);
- if (pwidth != NULL)
- *pwidth = len;
- if (bswidth != NULL)
- *bswidth = len;
- }
+ width = (int) strlen(pr);
} else
{
pr = prutfchar(ch);
- if (pwidth != NULL || bswidth != NULL)
+ if (is_composing_char(ch))
+ width = 0;
+ else if (is_ubin_char(ch))
+ width = (int) strlen(pr);
+ else
{
- if (is_composing_char(ch))
- {
- if (pwidth != NULL)
- *pwidth = 0;
- if (bswidth != NULL)
- *bswidth = 0;
- } else if (is_ubin_char(ch))
- {
- int len = (int) strlen(pr);
- if (pwidth != NULL)
- *pwidth = len;
- if (bswidth != NULL)
- *bswidth = len;
- } else
- {
- LWCHAR prev_ch = step_char(&p, -1, cmdbuf);
- if (is_combining_char(prev_ch, ch))
- {
- if (pwidth != NULL)
- *pwidth = 0;
- if (bswidth != NULL)
- *bswidth = 0;
- } else
- {
- if (pwidth != NULL)
- *pwidth = is_wide_char(ch)
- ? 2
- : 1;
- if (bswidth != NULL)
- *bswidth = 1;
- }
- }
+ LWCHAR prev_ch = step_char(&p, -1, cmdbuf);
+ if (is_combining_char(prev_ch, ch))
+ width = 0;
+ else
+ width = is_wide_char(ch) ? 2 : 1;
}
}
-
+ if (pwidth != NULL)
+ *pwidth = width;
+ if (bswidth != NULL)
+ *bswidth = width;
return (pr);
}
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
screen_trashed = 1;
break;
+ case A_LLSHIFT:
+ hshift = 0;
+ screen_trashed = 1;
+ break;
+
+ case A_RRSHIFT:
+ hshift = rrshift();
+ screen_trashed = 1;
+ break;
+
case A_PREFIX:
/*
* The command is incomplete (more chars are needed).
-/* Generated by "./mkutable -f2 Mn Me -- unicode/UnicodeData.txt" on Mon Jul 14 16:21:21 PDT 2014 */
+/* Generated by "./mkutable -f2 Mn Me -- unicode/UnicodeData.txt" on Tue Sep 20 10:51:43 PDT 2016 */
{ 0x0300, 0x036f }, /* Mn */
{ 0x0483, 0x0487 }, /* Mn */
{ 0x0488, 0x0489 }, /* Me */
{ 0x0825, 0x0827 }, /* Mn */
{ 0x0829, 0x082d }, /* Mn */
{ 0x0859, 0x085b }, /* Mn */
- { 0x08e4, 0x0902 }, /* Mn */
+ { 0x08d4, 0x08e1 }, /* Mn */
+ { 0x08e3, 0x0902 }, /* Mn */
{ 0x093a, 0x093a }, /* Mn */
{ 0x093c, 0x093c }, /* Mn */
{ 0x0941, 0x0948 }, /* Mn */
{ 0x17c9, 0x17d3 }, /* Mn */
{ 0x17dd, 0x17dd }, /* Mn */
{ 0x180b, 0x180d }, /* Mn */
+ { 0x1885, 0x1886 }, /* Mn */
{ 0x18a9, 0x18a9 }, /* Mn */
{ 0x1920, 0x1922 }, /* Mn */
{ 0x1927, 0x1928 }, /* Mn */
{ 0x1cf4, 0x1cf4 }, /* Mn */
{ 0x1cf8, 0x1cf9 }, /* Mn */
{ 0x1dc0, 0x1df5 }, /* Mn */
- { 0x1dfc, 0x1dff }, /* Mn */
+ { 0x1dfb, 0x1dff }, /* Mn */
{ 0x20d0, 0x20dc }, /* Mn */
{ 0x20dd, 0x20e0 }, /* Me */
{ 0x20e1, 0x20e1 }, /* Mn */
{ 0xa66f, 0xa66f }, /* Mn */
{ 0xa670, 0xa672 }, /* Me */
{ 0xa674, 0xa67d }, /* Mn */
- { 0xa69f, 0xa69f }, /* Mn */
+ { 0xa69e, 0xa69f }, /* Mn */
{ 0xa6f0, 0xa6f1 }, /* Mn */
{ 0xa802, 0xa802 }, /* Mn */
{ 0xa806, 0xa806 }, /* Mn */
{ 0xa80b, 0xa80b }, /* Mn */
{ 0xa825, 0xa826 }, /* Mn */
- { 0xa8c4, 0xa8c4 }, /* Mn */
+ { 0xa8c4, 0xa8c5 }, /* Mn */
{ 0xa8e0, 0xa8f1 }, /* Mn */
{ 0xa926, 0xa92d }, /* Mn */
{ 0xa947, 0xa951 }, /* Mn */
{ 0xabed, 0xabed }, /* Mn */
{ 0xfb1e, 0xfb1e }, /* Mn */
{ 0xfe00, 0xfe0f }, /* Mn */
- { 0xfe20, 0xfe2d }, /* Mn */
+ { 0xfe20, 0xfe2f }, /* Mn */
{ 0x101fd, 0x101fd }, /* Mn */
{ 0x102e0, 0x102e0 }, /* Mn */
{ 0x10376, 0x1037a }, /* Mn */
{ 0x11173, 0x11173 }, /* Mn */
{ 0x11180, 0x11181 }, /* Mn */
{ 0x111b6, 0x111be }, /* Mn */
+ { 0x111ca, 0x111cc }, /* Mn */
{ 0x1122f, 0x11231 }, /* Mn */
{ 0x11234, 0x11234 }, /* Mn */
{ 0x11236, 0x11237 }, /* Mn */
+ { 0x1123e, 0x1123e }, /* Mn */
{ 0x112df, 0x112df }, /* Mn */
{ 0x112e3, 0x112ea }, /* Mn */
- { 0x11301, 0x11301 }, /* Mn */
+ { 0x11300, 0x11301 }, /* Mn */
{ 0x1133c, 0x1133c }, /* Mn */
{ 0x11340, 0x11340 }, /* Mn */
{ 0x11366, 0x1136c }, /* Mn */
{ 0x11370, 0x11374 }, /* Mn */
+ { 0x11438, 0x1143f }, /* Mn */
+ { 0x11442, 0x11444 }, /* Mn */
+ { 0x11446, 0x11446 }, /* Mn */
{ 0x114b3, 0x114b8 }, /* Mn */
{ 0x114ba, 0x114ba }, /* Mn */
{ 0x114bf, 0x114c0 }, /* Mn */
{ 0x115b2, 0x115b5 }, /* Mn */
{ 0x115bc, 0x115bd }, /* Mn */
{ 0x115bf, 0x115c0 }, /* Mn */
+ { 0x115dc, 0x115dd }, /* Mn */
{ 0x11633, 0x1163a }, /* Mn */
{ 0x1163d, 0x1163d }, /* Mn */
{ 0x1163f, 0x11640 }, /* Mn */
{ 0x116ad, 0x116ad }, /* Mn */
{ 0x116b0, 0x116b5 }, /* Mn */
{ 0x116b7, 0x116b7 }, /* Mn */
+ { 0x1171d, 0x1171f }, /* Mn */
+ { 0x11722, 0x11725 }, /* Mn */
+ { 0x11727, 0x1172b }, /* Mn */
+ { 0x11c30, 0x11c36 }, /* Mn */
+ { 0x11c38, 0x11c3d }, /* Mn */
+ { 0x11c3f, 0x11c3f }, /* Mn */
+ { 0x11c92, 0x11ca7 }, /* Mn */
+ { 0x11caa, 0x11cb0 }, /* Mn */
+ { 0x11cb2, 0x11cb3 }, /* Mn */
+ { 0x11cb5, 0x11cb6 }, /* Mn */
{ 0x16af0, 0x16af4 }, /* Mn */
{ 0x16b30, 0x16b36 }, /* Mn */
{ 0x16f8f, 0x16f92 }, /* Mn */
{ 0x1d185, 0x1d18b }, /* Mn */
{ 0x1d1aa, 0x1d1ad }, /* Mn */
{ 0x1d242, 0x1d244 }, /* Mn */
+ { 0x1da00, 0x1da36 }, /* Mn */
+ { 0x1da3b, 0x1da6c }, /* Mn */
+ { 0x1da75, 0x1da75 }, /* Mn */
+ { 0x1da84, 0x1da84 }, /* Mn */
+ { 0x1da9b, 0x1da9f }, /* Mn */
+ { 0x1daa1, 0x1daaf }, /* Mn */
+ { 0x1e000, 0x1e006 }, /* Mn */
+ { 0x1e008, 0x1e018 }, /* Mn */
+ { 0x1e01b, 0x1e021 }, /* Mn */
+ { 0x1e023, 0x1e024 }, /* Mn */
+ { 0x1e026, 0x1e02a }, /* Mn */
{ 0x1e8d0, 0x1e8d6 }, /* Mn */
+ { 0x1e944, 0x1e94a }, /* Mn */
{ 0xe0100, 0xe01ef }, /* Mn */
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --with-secure Compile in secure mode
- --with-no-float Do not use floating point
- --with-regex={auto,gnu,pcre,posix,regcmp,re_comp,regcomp,regcomp-local,none} Select a regular expression library auto
- --with-editor=PROGRAM use PROGRAM as the default editor vi
+ --with-secure Compile in secure mode
+ --with-no-float Do not use floating point
+ --with-regex=LIB select regular expression library (LIB is one of auto,none,gnu,pcre,posix,regcmp,re_comp,regcomp,regcomp-local) [auto]
+ --with-editor=PROGRAM use PROGRAM as the default editor [vi]
Some influential environment variables:
CC C compiler command
# Compile in secure mode?
AC_ARG_WITH(secure,
- [ --with-secure Compile in secure mode],
+ [ --with-secure Compile in secure mode],
AC_DEFINE(SECURE_COMPILE, 1), AC_DEFINE(SECURE_COMPILE, 0))
# Should we use floating point?
AC_MSG_CHECKING(for floating point)
AC_ARG_WITH(no-float,
- [ --with-no-float Do not use floating point],
+ [ --with-no-float Do not use floating point],
WANT_NO_FLOAT=1, WANT_NO_FLOAT=0)
if test $WANT_NO_FLOAT = 0; then
AC_TRY_LINK(, [double f1 = 12.5; double f2 = f1*f1/2.5;],
# Select a regular expression library.
WANT_REGEX=auto
AC_ARG_WITH(regex,
- [ --with-regex={auto,gnu,pcre,posix,regcmp,re_comp,regcomp,regcomp-local,none} Select a regular expression library [auto]],
+ [ --with-regex=LIB select regular expression library (LIB is one of auto,none,gnu,pcre,posix,regcmp,re_comp,regcomp,regcomp-local) [[auto]]],
WANT_REGEX="$withval")
if test $have_regex = no; then
AC_MSG_RESULT(regular expression library: $supported_regex)
AC_ARG_WITH(editor,
- [ --with-editor=PROGRAM use PROGRAM as the default editor [vi]],
+ [ --with-editor=PROGRAM use PROGRAM as the default editor [[vi]]],
AC_DEFINE_UNQUOTED(EDIT_PGM, "$withval"), AC_DEFINE(EDIT_PGM, "vi"))
AH_TOP([
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
ESC,']',0, A_RSHIFT,
ESC,'(',0, A_LSHIFT,
ESC,')',0, A_RSHIFT,
+ ESC,'{',0, A_LLSHIFT,
+ ESC,'}',0, A_RRSHIFT,
SK(SK_RIGHT_ARROW),0, A_RSHIFT,
SK(SK_LEFT_ARROW),0, A_LSHIFT,
+ SK(SK_CTL_RIGHT_ARROW),0, A_RRSHIFT,
+ SK(SK_CTL_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,
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
public void null_line ();
public POSITION forw_raw_line ();
public POSITION back_raw_line ();
+ public int rrshift ();
public void clr_linenum ();
public void add_lnum ();
public LINENUM find_linenum ();
public POSITION next_unfiltered ();
public POSITION prev_unfiltered ();
public int is_hilited ();
- public void chg_caseless ();
public void chg_hilite ();
+ public void chg_caseless ();
public int search ();
public void prep_hilite ();
public void set_filter_pattern ();
' ',' ','E','S','C','-','S','P','A','C','E',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','F','o','r','w','a','r','d',' ',' ','o','n','e',' ','w','i','n','d','o','w',',',' ','b','u','t',' ','d','o','n','\'','t',' ','s','t','o','p',' ','a','t',' ','e','n','d','-','o','f','-','f','i','l','e','.','\n',
' ',' ','d',' ',' ','^','D',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','F','o','r','w','a','r','d',' ',' ','o','n','e',' ','h','a','l','f','-','w','i','n','d','o','w',' ','(','a','n','d',' ','s','e','t',' ','h','a','l','f','-','w','i','n','d','o','w',' ','t','o',' ','_','\b','N',')','.','\n',
' ',' ','u',' ',' ','^','U',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','B','a','c','k','w','a','r','d',' ','o','n','e',' ','h','a','l','f','-','w','i','n','d','o','w',' ','(','a','n','d',' ','s','e','t',' ','h','a','l','f','-','w','i','n','d','o','w',' ','t','o',' ','_','\b','N',')','.','\n',
-' ',' ','E','S','C','-',')',' ',' ','R','i','g','h','t','A','r','r','o','w',' ','*',' ',' ','L','e','f','t',' ',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',' ','(','o','r',' ','_','\b','N',' ','p','o','s','i','t','i','o','n','s',')','.','\n',
-' ',' ','E','S','C','-','(',' ',' ','L','e','f','t','A','r','r','o','w',' ',' ','*',' ',' ','R','i','g','h','t',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',' ','(','o','r',' ','_','\b','N',' ','p','o','s','i','t','i','o','n','s',')','.','\n',
+' ',' ','E','S','C','-',')',' ',' ','R','i','g','h','t','A','r','r','o','w',' ','*',' ',' ','R','i','g','h','t',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',' ','(','o','r',' ','_','\b','N',' ','p','o','s','i','t','i','o','n','s',')','.','\n',
+' ',' ','E','S','C','-','(',' ',' ','L','e','f','t','A','r','r','o','w',' ',' ','*',' ',' ','L','e','f','t',' ',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',' ','(','o','r',' ','_','\b','N',' ','p','o','s','i','t','i','o','n','s',')','.','\n',
+' ',' ','E','S','C','-','}',' ',' ','^','R','i','g','h','t','A','r','r','o','w',' ',' ',' ','R','i','g','h','t',' ','t','o',' ','l','a','s','t',' ','c','o','l','u','m','n',' ','d','i','s','p','l','a','y','e','d','.','\n',
+' ',' ','E','S','C','-','{',' ',' ','^','L','e','f','t','A','r','r','o','w',' ',' ',' ',' ','L','e','f','t',' ',' ','t','o',' ','f','i','r','s','t',' ','c','o','l','u','m','n','.','\n',
' ',' ','F',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','F','o','r','w','a','r','d',' ','f','o','r','e','v','e','r',';',' ','l','i','k','e',' ','"','t','a','i','l',' ','-','f','"','.','\n',
' ',' ','E','S','C','-','F',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','L','i','k','e',' ','F',' ','b','u','t',' ','s','t','o','p',' ','w','h','e','n',' ','s','e','a','r','c','h',' ','p','a','t','t','e','r','n',' ','i','s',' ','f','o','u','n','d','.','\n',
' ',' ','r',' ',' ','^','R',' ',' ','^','L',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','R','e','p','a','i','n','t',' ','s','c','r','e','e','n','.','\n',
'\n',
' ',' ','!','_','\b','c','_','\b','o','_','\b','m','_','\b','m','_','\b','a','_','\b','n','_','\b','d',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','x','e','c','u','t','e',' ','t','h','e',' ','s','h','e','l','l',' ','c','o','m','m','a','n','d',' ','w','i','t','h',' ','$','S','H','E','L','L','.','\n',
' ',' ','|','X','\b','X','_','\b','c','_','\b','o','_','\b','m','_','\b','m','_','\b','a','_','\b','n','_','\b','d',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','P','i','p','e',' ','f','i','l','e',' ','b','e','t','w','e','e','n',' ','c','u','r','r','e','n','t',' ','p','o','s',' ','&',' ','m','a','r','k',' ','X','\b','X',' ','t','o',' ','s','h','e','l','l',' ','c','o','m','m','a','n','d','.','\n',
+' ',' ','s',' ','_','\b','f','_','\b','i','_','\b','l','_','\b','e',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','a','v','e',' ','i','n','p','u','t',' ','t','o',' ','a',' ','f','i','l','e','.','\n',
' ',' ','v',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','d','i','t',' ','t','h','e',' ','c','u','r','r','e','n','t',' ','f','i','l','e',' ','w','i','t','h',' ','$','V','I','S','U','A','L',' ','o','r',' ','$','E','D','I','T','O','R','.','\n',
' ',' ','V',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','P','r','i','n','t',' ','v','e','r','s','i','o','n',' ','n','u','m','b','e','r',' ','o','f',' ','"','l','e','s','s','"','.','\n',
' ','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\n',
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
*/
get_scrpos(&scrpos);
pos_clear();
- jump_loc(scrpos.pos, scrpos.ln);
+ if (scrpos.pos == NULL_POSITION)
+ /* Screen hasn't been drawn yet. */
+ jump_loc(0, 0);
+ else
+ jump_loc(scrpos.pos, scrpos.ln);
}
/*
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
ESC-SPACE * Forward one window, but don't stop at end-of-file.
d ^D * Forward one half-window (and set half-window to _\bN).
u ^U * Backward one half-window (and set half-window to _\bN).
- ESC-) RightArrow * Left one half screen width (or _\bN positions).
- ESC-( LeftArrow * Right one half screen width (or _\bN positions).
+ ESC-) RightArrow * Right one half screen width (or _\bN positions).
+ ESC-( LeftArrow * Left one half screen width (or _\bN positions).
+ ESC-} ^RightArrow Right to last column displayed.
+ ESC-{ ^LeftArrow Left to first column.
F Forward forever; like "tail -f".
ESC-F Like F but stop when search pattern is found.
r ^R ^L Repaint screen.
!_\bc_\bo_\bm_\bm_\ba_\bn_\bd Execute the shell command with $SHELL.
|X\bX_\bc_\bo_\bm_\bm_\ba_\bn_\bd Pipe file between current pos & mark X\bX to shell command.
+ s _\bf_\bi_\bl_\be Save input to a file.
v Edit the current file with $VISUAL or $EDITOR.
V Print version number of "less".
---------------------------------------------------------------------------
becomes the default for future RIGHTARROW and LEFTARROW com-
mands.
+ ESC-} or ^RIGHTARROW
+ Scroll horizontally right to show the end of the longest dis-
+ played line.
+
+ ESC-{ or ^LEFTARROW
+ Scroll horizontally left back to the first column.
+
r or ^R or ^L
Repaint the screen.
- R Repaint the screen, discarding any buffered input. Useful if
+ R Repaint the screen, discarding any buffered input. Useful if
the file is changing while it is being viewed.
- F Scroll forward, and keep trying to read when the end of file is
- reached. Normally this command would be used when already at
- the end of the file. It is a way to monitor the tail of a file
- which is growing while it is being viewed. (The behavior is
+ F Scroll forward, and keep trying to read when the end of file is
+ reached. Normally this command would be used when already at
+ the end of the file. It is a way to monitor the tail of a file
+ which is growing while it is being viewed. (The behavior is
similar to the "tail -f" command.)
- ESC-F Like F, but as soon as a line is found which matches the last
- search pattern, the terminal bell is rung and forward scrolling
+ ESC-F 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.
g or < or ESC-<
ing: this may be slow if N is large.)
G or > or ESC->
- Go to line N in the file, default the end of the file. (Warn-
- ing: this may be slow if N is large, or if N is not specified
+ Go to line N in the file, default the end of the file. (Warn-
+ ing: this may be slow if N is large, or if N is not specified
and standard input, rather than a file, is being read.)
- ESC-G Same as G, except if no number N is specified and the input is
- standard input, goes to the last line which is currently
+ ESC-G Same as G, except if no number N is specified and the input is
+ standard input, goes to the last line which is currently
buffered.
p or % Go to a position N percent into the file. N should be between 0
P Go to the line containing byte offset N in the file.
{ If a left curly bracket appears in the top line displayed on the
- screen, the { command will go to the matching right curly
- bracket. The matching right curly bracket is positioned on the
+ screen, the { command will go to the matching right curly
+ bracket. The matching right curly bracket is positioned on the
bottom line of the screen. If there is more than one left curly
- bracket on the top line, a number N may be used to specify the
+ bracket on the top line, a number N may be used to specify the
N-th bracket on the line.
} If a right curly bracket appears in the bottom line displayed on
- the screen, the } command will go to the matching left curly
- bracket. The matching left curly bracket is positioned on the
- top line of the screen. If there is more than one right curly
- bracket on the top line, a number N may be used to specify the
+ the screen, the } command will go to the matching left curly
+ bracket. The matching left curly bracket is positioned on the
+ top line of the screen. If there is more than one right curly
+ bracket on the top line, a number N may be used to specify the
N-th bracket on the line.
( Like {, but applies to parentheses rather than curly brackets.
) Like }, but applies to parentheses rather than curly brackets.
- [ Like {, but applies to square brackets rather than curly brack-
+ [ Like {, but applies to square brackets rather than curly brack-
ets.
- ] Like }, but applies to square brackets rather than curly brack-
+ ] Like }, but applies to square brackets rather than curly brack-
ets.
- ESC-^F Followed by two characters, acts like {, but uses the two char-
- acters as open and close brackets, respectively. For example,
- "ESC ^F < >" could be used to go forward to the > which matches
+ ESC-^F Followed by two characters, acts like {, but uses the two char-
+ acters as open and close brackets, respectively. For example,
+ "ESC ^F < >" could be used to go forward to the > which matches
the < in the top displayed line.
- ESC-^B Followed by two characters, acts like }, but uses the two char-
- acters as open and close brackets, respectively. For example,
+ ESC-^B Followed by two characters, acts like }, but uses the two char-
+ acters as open and close brackets, respectively. For example,
"ESC ^B < >" could be used to go backward to the < which matches
the > in the bottom displayed line.
- m Followed by any lowercase letter, marks the current position
+ m Followed by any lowercase letter, marks the current position
with that letter.
- ' (Single quote.) Followed by any lowercase letter, returns to
+ ' (Single quote.) Followed by any lowercase letter, returns to
the position which was previously marked with that letter. Fol-
- lowed by another single quote, returns to the position at which
+ lowed by another single quote, returns to the position at which
the last "large" movement command was executed. Followed by a ^
- or $, jumps to the beginning or end of the file respectively.
- Marks are preserved when a new file is examined, so the ' com-
+ or $, jumps to the beginning or end of the file respectively.
+ Marks are preserved when a new file is examined, so the ' com-
mand can be used to switch between input files.
^X^X Same as single quote.
/pattern
Search forward in the file for the N-th line containing the pat-
tern. N defaults to 1. The pattern is a regular expression, as
- recognized by the regular expression library supplied by your
- system. The search starts at the first line displayed (but see
+ recognized by the regular expression library supplied by your
+ system. The search starts at the first line displayed (but see
the -a and -j options, which change this).
- Certain characters are special if entered at the beginning of
- the pattern; they modify the type of search rather than become
+ Certain characters are special if entered at the beginning of
+ the pattern; they modify the type of search rather than become
part of the pattern:
^N or !
Search for lines which do NOT match the pattern.
^E or *
- Search multiple files. That is, if the search reaches
- the END of the current file without finding a match, the
- search continues in the next file in the command line
+ Search multiple files. That is, if the search reaches
+ the END of the current file without finding a match, the
+ search continues in the next file in the command line
list.
^F or @
- Begin the search at the first line of the FIRST file in
- the command line list, regardless of what is currently
- displayed on the screen or the settings of the -a or -j
+ Begin the search at the first line of the FIRST file in
+ the command line list, regardless of what is currently
+ displayed on the screen or the settings of the -a or -j
options.
- ^K Highlight any text which matches the pattern on the cur-
+ ^K Highlight any text which matches the pattern on the cur-
rent screen, but don't move to the first match (KEEP cur-
rent position).
- ^R Don't interpret regular expression metacharacters; that
+ ^R Don't interpret regular expression metacharacters; that
is, do a simple textual comparison.
?pattern
- Search backward in the file for the N-th line containing the
- pattern. The search starts at the last line displayed (but see
+ Search backward in the file for the N-th line containing the
+ pattern. The search starts at the last line displayed (but see
the -a and -j options, which change this).
Certain characters are special as in the / command:
Search for lines which do NOT match the pattern.
^E or *
- Search multiple files. That is, if the search reaches
- the beginning of the current file without finding a
- match, the search continues in the previous file in the
+ Search multiple files. That is, if the search reaches
+ the beginning of the current file without finding a
+ match, the search continues in the previous file in the
command line list.
^F or @
Begin the search at the last line of the last file in the
- command line list, regardless of what is currently dis-
- played on the screen or the settings of the -a or -j
+ command line list, regardless of what is currently dis-
+ played on the screen or the settings of the -a or -j
options.
^K As in forward searches.
ESC-?pattern
Same as "?*".
- n Repeat previous search, for N-th line containing the last pat-
- tern. If the previous search was modified by ^N, the search is
- made for the N-th line NOT containing the pattern. If the pre-
- vious search was modified by ^E, the search continues in the
- next (or previous) file if not satisfied in the current file.
- If the previous search was modified by ^R, the search is done
- without using regular expressions. There is no effect if the
+ n Repeat previous search, for N-th line containing the last pat-
+ tern. If the previous search was modified by ^N, the search is
+ made for the N-th line NOT containing the pattern. If the pre-
+ vious search was modified by ^E, the search continues in the
+ next (or previous) file if not satisfied in the current file.
+ If the previous search was modified by ^R, the search is done
+ without using regular expressions. There is no effect if the
previous search was modified by ^F or ^K.
N Repeat previous search, but in the reverse direction.
- ESC-n Repeat previous search, but crossing file boundaries. The
+ ESC-n Repeat previous search, but crossing file boundaries. The
effect is as if the previous search were modified by *.
- ESC-N Repeat previous search, but in the reverse direction and cross-
+ ESC-N Repeat previous search, but in the reverse direction and cross-
ing file boundaries.
- ESC-u Undo search highlighting. Turn off highlighting of strings
+ ESC-u Undo search highlighting. Turn off highlighting of strings
matching the current search pattern. If highlighting is already
- off because of a previous ESC-u command, turn highlighting back
- on. Any search command will also turn highlighting back on.
+ off because of a previous ESC-u command, turn highlighting back
+ on. Any search command will also turn highlighting back on.
(Highlighting can also be disabled by toggling the -G option; in
that case search commands do not turn highlighting back on.)
&pattern
- Display only lines which match the pattern; lines which do not
- match the pattern are not displayed. If pattern is empty (if
- you type & immediately followed by ENTER), any filtering is
- turned off, and all lines are displayed. While filtering is in
- effect, an ampersand is displayed at the beginning of the
+ Display only lines which match the pattern; lines which do not
+ match the pattern are not displayed. If pattern is empty (if
+ you type & immediately followed by ENTER), any filtering is
+ turned off, and all lines are displayed. While filtering is in
+ effect, an ampersand is displayed at the beginning of the
prompt, as a reminder that some lines in the file may be hidden.
Certain characters are special as in the / command:
^N or !
Display only lines which do NOT match the pattern.
- ^R Don't interpret regular expression metacharacters; that
+ ^R Don't interpret regular expression metacharacters; that
is, do a simple textual comparison.
:e [filename]
- Examine a new file. If the filename is missing, the "current"
- file (see the :n and :p commands below) from the list of files
- in the command line is re-examined. A percent sign (%) in the
- filename is replaced by the name of the current file. A pound
- sign (#) is replaced by the name of the previously examined
- file. However, two consecutive percent signs are simply
+ Examine a new file. If the filename is missing, the "current"
+ file (see the :n and :p commands below) from the list of files
+ in the command line is re-examined. A percent sign (%) in the
+ filename is replaced by the name of the current file. A pound
+ sign (#) is replaced by the name of the previously examined
+ file. However, two consecutive percent signs are simply
replaced with a single percent sign. This allows you to enter a
- filename that contains a percent sign in the name. Similarly,
- two consecutive pound signs are replaced with a single pound
- sign. The filename is inserted into the command line list of
- files so that it can be seen by subsequent :n and :p commands.
+ filename that contains a percent sign in the name. Similarly,
+ two consecutive pound signs are replaced with a single pound
+ sign. The filename is inserted into the command line list of
+ files so that it can be seen by subsequent :n and :p commands.
If the filename consists of several files, they are all inserted
- into the list of files and the first one is examined. If the
+ into the list of files and the first one is examined. If the
filename contains one or more spaces, the entire filename should
be enclosed in double quotes (also see the -" option).
^X^V or E
- Same as :e. Warning: some systems use ^V as a special literal-
- ization character. On such systems, you may not be able to use
+ Same as :e. Warning: some systems use ^V as a special literal-
+ ization character. On such systems, you may not be able to use
^V.
- :n Examine the next file (from the list of files given in the com-
- mand line). If a number N is specified, the N-th next file is
+ :n Examine the next file (from the list of files given in the com-
+ mand line). If a number N is specified, the N-th next file is
examined.
:p Examine the previous file in the command line list. If a number
N is specified, the N-th previous file is examined.
- :x Examine the first file in the command line list. If a number N
+ :x Examine the first file in the command line list. If a number N
is specified, the N-th file in the list is examined.
:d Remove the current file from the list of files.
- t Go to the next tag, if there were more than one matches for the
+ t Go to the next tag, if there were more than one matches for the
current tag. See the -t option for more details about tags.
- T Go to the previous tag, if there were more than one matches for
+ T Go to the previous tag, if there were more than one matches for
the current tag.
= or ^G or :f
- Prints some information about the file being viewed, including
- its name and the line number and byte offset of the bottom line
- being displayed. If possible, it also prints the length of the
- file, the number of lines in the file and the percent of the
+ Prints some information about the file being viewed, including
+ its name and the line number and byte offset of the bottom line
+ being displayed. If possible, it also prints the length of the
+ file, the number of lines in the file and the percent of the
file above the last displayed line.
- - Followed by one of the command line option letters (see OPTIONS
- below), this will change the setting of that option and print a
- message describing the new setting. If a ^P (CONTROL-P) is
+ - Followed by one of the command line option letters (see OPTIONS
+ below), this will change the setting of that option and print a
+ message describing the new setting. If a ^P (CONTROL-P) is
entered immediately after the dash, the setting of the option is
- changed but no message is printed. If the option letter has a
- numeric value (such as -b or -h), or a string value (such as -P
- or -t), a new value may be entered after the option letter. If
- no new value is entered, a message describing the current set-
+ changed but no message is printed. If the option letter has a
+ numeric value (such as -b or -h), or a string value (such as -P
+ or -t), a new value may be entered after the option letter. If
+ no new value is entered, a message describing the current set-
ting is printed and nothing is changed.
- -- Like the - command, but takes a long option name (see OPTIONS
+ -- Like the - command, but takes a long option name (see OPTIONS
below) rather than a single option letter. You must press ENTER
- or RETURN after typing the option name. A ^P immediately after
- the second dash suppresses printing of a message describing the
+ or RETURN after typing the option name. A ^P immediately after
+ the second dash suppresses printing of a message describing the
new setting, as in the - command.
- -+ Followed by one of the command line option letters this will
- reset the option to its default setting and print a message
- describing the new setting. (The "-+\e[4mX\e[24m" command does the same
- thing as "-+\e[4mX\e[24m" on the command line.) This does not work for
+ -+ Followed by one of the command line option letters this will
+ reset the option to its default setting and print a message
+ describing the new setting. (The "-+\e[4mX\e[24m" command does the same
+ thing as "-+\e[4mX\e[24m" on the command line.) This does not work for
string-valued options.
- --+ Like the -+ command, but takes a long option name rather than a
+ --+ Like the -+ command, but takes a long option name rather than a
single option letter.
- -! Followed by one of the command line option letters, this will
- reset the option to the "opposite" of its default setting and
- print a message describing the new setting. This does not work
+ -! Followed by one of the command line option letters, this will
+ reset the option to the "opposite" of its default setting and
+ print a message describing the new setting. This does not work
for numeric or string-valued options.
- --! Like the -! command, but takes a long option name rather than a
+ --! Like the -! command, but takes a long option name rather than a
single option letter.
- _ (Underscore.) Followed by one of the command line option let-
- ters, this will print a message describing the current setting
+ _ (Underscore.) Followed by one of the command line option let-
+ ters, this will print a message describing the current setting
of that option. The setting of the option is not changed.
__ (Double underscore.) Like the _ (underscore) command, but takes
a long option name rather than a single option letter. You must
press ENTER or RETURN after typing the option name.
- +cmd Causes the specified cmd to be executed each time a new file is
+ +cmd Causes the specified cmd to be executed each time a new file is
examined. For example, +G causes \e[4mless\e[24m to initially display each
file starting at the end rather than the beginning.
q or Q or :q or :Q or ZZ
Exits \e[4mless.\e[0m
- The following four commands may or may not be valid, depending on your
+ The following four commands may or may not be valid, depending on your
particular installation.
- v Invokes an editor to edit the current file being viewed. The
+ v Invokes an editor to edit the current file being viewed. The
editor is taken from the environment variable VISUAL if defined,
- or EDITOR if VISUAL is not defined, or defaults to "vi" if nei-
- ther VISUAL nor EDITOR is defined. See also the discussion of
+ or EDITOR if VISUAL is not defined, or defaults to "vi" if nei-
+ ther VISUAL nor EDITOR is defined. See also the discussion of
LESSEDIT under the section on PROMPTS below.
! shell-command
- Invokes a shell to run the shell-command given. A percent sign
- (%) in the command is replaced by the name of the current file.
+ Invokes a shell to run the shell-command given. A percent sign
+ (%) in the command is replaced by the name of the current file.
A pound sign (#) is replaced by the name of the previously exam-
- ined file. "!!" repeats the last shell command. "!" with no
- shell command simply invokes a shell. On Unix systems, the
- shell is taken from the environment variable SHELL, or defaults
- to "sh". On MS-DOS and OS/2 systems, the shell is the normal
+ ined file. "!!" repeats the last shell command. "!" with no
+ shell command simply invokes a shell. On Unix systems, the
+ shell is taken from the environment variable SHELL, or defaults
+ to "sh". On MS-DOS and OS/2 systems, the shell is the normal
command processor.
| <m> shell-command
- <m> represents any mark letter. Pipes a section of the input
- file to the given shell command. The section of the file to be
- piped is between the first line on the current screen and the
- position marked by the letter. <m> may also be ^ or $ to indi-
+ <m> represents any mark letter. Pipes a section of the input
+ file to the given shell command. The section of the file to be
+ piped is between the first line on the current screen and the
+ position marked by the letter. <m> may also be ^ or $ to indi-
cate beginning or end of file respectively. If <m> is . or new-
line, the current screen is piped.
s filename
- Save the input to a file. This only works if the input is a
+ Save the input to a file. This only works if the input is a
pipe, not an ordinary file.
\e[1mOPTIONS\e[0m
- Command line options are described below. Most options may be changed
+ Command line options are described below. Most options may be changed
while \e[4mless\e[24m is running, via the "-" command.
- Most options may be given in one of two forms: either a dash followed
- by a single letter, or two dashes followed by a long option name. A
- long option name may be abbreviated as long as the abbreviation is
+ Most options may be given in one of two forms: either a dash followed
+ by a single letter, or two dashes followed by a long option name. A
+ long option name may be abbreviated as long as the abbreviation is
unambiguous. For example, --quit-at-eof may be abbreviated --quit, but
not --qui, since both --quit-at-eof and --quiet begin with --qui. Some
- long option names are in uppercase, such as --QUIT-AT-EOF, as distinct
- from --quit-at-eof. Such option names need only have their first let-
- ter capitalized; the remainder of the name may be in either case. For
+ long option names are in uppercase, such as --QUIT-AT-EOF, as distinct
+ from --quit-at-eof. Such option names need only have their first let-
+ ter capitalized; the remainder of the name may be in either case. For
example, --Quit-at-eof is equivalent to --QUIT-AT-EOF.
Options are also taken from the environment variable "LESS". For exam-
LESS="-options"; export LESS
- On MS-DOS, you don't need the quotes, but you should replace any per-
+ On MS-DOS, you don't need the quotes, but you should replace any per-
cent signs in the options string by double percent signs.
- The environment variable is parsed before the command line, so command
- line options override the LESS environment variable. If an option
- appears in the LESS variable, it can be reset to its default value on
+ The environment variable is parsed before the command line, so command
+ line options override the LESS environment variable. If an option
+ appears in the LESS variable, it can be reset to its default value on
the command line by beginning the command line option with "-+".
- Some options like -k or -D require a string to follow the option let-
- ter. The string for that option is considered to end when a dollar
- sign ($) is found. For example, you can set two -D options on MS-DOS
+ Some options like -k or -D require a string to follow the option let-
+ ter. The string for that option is considered to end when a dollar
+ sign ($) is found. For example, you can set two -D options on MS-DOS
like this:
LESS="Dn9.1$Ds4.1"
- If the --use-backslash option appears earlier in the options, then a
- dollar sign or backslash may be included literally in an option string
+ If the --use-backslash option appears earlier in the options, then a
+ dollar sign or backslash may be included literally in an option string
by preceding it with a backslash. If the --use-backslash option is not
- in effect, then backslashes are not treated specially, and there is no
+ in effect, then backslashes are not treated specially, and there is no
way to include a dollar sign in the option string.
-? or --help
- This option displays a summary of the commands accepted by \e[4mless\e[0m
- (the same as the h command). (Depending on how your shell
- interprets the question mark, it may be necessary to quote the
+ This option displays a summary of the commands accepted by \e[4mless\e[0m
+ (the same as the h command). (Depending on how your shell
+ interprets the question mark, it may be necessary to quote the
question mark, thus: "-\?".)
-a or --search-skip-screen
- By default, forward searches start at the top of the displayed
- screen and backwards searches start at the bottom of the dis-
- played screen (except for repeated searches invoked by the n or
- N commands, which start after or before the "target" line
+ By default, forward searches start at the top of the displayed
+ screen and backwards searches start at the bottom of the dis-
+ played screen (except for repeated searches invoked by the n or
+ N commands, which start after or before the "target" line
respectively; see the -j option for more about the target line).
- The -a option causes forward searches to instead start at the
- bottom of the screen and backward searches to start at the top
+ The -a option causes forward searches to instead start at the
+ bottom of the screen and backward searches to start at the top
of the screen, thus skipping all lines displayed on the screen.
-A or --SEARCH-SKIP-SCREEN
- Causes all forward searches (not just non-repeated searches) to
- start just after the target line, and all backward searches to
- start just before the target line. Thus, forward searches will
+ Causes all forward searches (not just non-repeated searches) to
+ start just after the target line, and all backward searches to
+ start just before the target line. Thus, forward searches will
skip part of the displayed screen (from the first line up to and
- including the target line). Similarly backwards searches will
+ including the target line). Similarly backwards searches will
skip the displayed screen from the last line up to and including
the target line. This was the default behavior in less versions
prior to 441.
-b\e[4mn\e[24m or --buffers=\e[4mn\e[0m
- Specifies the amount of buffer space \e[4mless\e[24m will use for each
- file, in units of kilobytes (1024 bytes). By default 64 K of
- buffer space is used for each file (unless the file is a pipe;
- see the -B option). The -b option specifies instead that \e[4mn\e[0m
+ Specifies the amount of buffer space \e[4mless\e[24m will use for each
+ file, in units of kilobytes (1024 bytes). By default 64 K of
+ buffer space is used for each file (unless the file is a pipe;
+ see the -B option). The -b option specifies instead that \e[4mn\e[0m
kilobytes of buffer space should be used for each file. If \e[4mn\e[24m is
- -1, buffer space is unlimited; that is, the entire file can be
+ -1, buffer space is unlimited; that is, the entire file can be
read into memory.
-B or --auto-buffers
By default, when data is read from a pipe, buffers are allocated
automatically as needed. If a large amount of data is read from
- the pipe, this can cause a large amount of memory to be allo-
+ the pipe, this can cause a large amount of memory to be allo-
cated. The -B option disables this automatic allocation of buf-
fers for pipes, so that only 64 K (or the amount of space speci-
fied by the -b option) is used for the pipe. Warning: use of -B
- can result in erroneous display, since only the most recently
- viewed part of the piped data is kept in memory; any earlier
+ can result in erroneous display, since only the most recently
+ viewed part of the piped data is kept in memory; any earlier
data is lost.
-c or --clear-screen
- Causes full screen repaints to be painted from the top line
- down. By default, full screen repaints are done by scrolling
+ Causes full screen repaints to be painted from the top line
+ down. By default, full screen repaints are done by scrolling
from the bottom of the screen.
-C or --CLEAR-SCREEN
-d or --dumb
The -d option suppresses the error message normally displayed if
- the terminal is dumb; that is, lacks some important capability,
+ the terminal is dumb; that is, lacks some important capability,
such as the ability to clear the screen or scroll backward. The
- -d option does not otherwise change the behavior of \e[4mless\e[24m on a
+ -d option does not otherwise change the behavior of \e[4mless\e[24m on a
dumb terminal.
-D\e[1mx\e[4m\e[22mcolor\e[24m or --color=\e[1mx\e[4m\e[22mcolor\e[0m
[MS-DOS only] Sets the color of the text displayed. \e[1mx \e[22mis a sin-
- gle character which selects the type of text whose color is
- being set: n=normal, s=standout, d=bold, u=underlined, k=blink.
- \e[4mcolor\e[24m is a pair of numbers separated by a period. The first
- number selects the foreground color and the second selects the
- background color of the text. A single number \e[4mN\e[24m is the same as
- \e[4mN.M\e[24m, where \e[4mM\e[24m is the normal background color.
+ gle character which selects the type of text whose color is
+ being set: n=normal, s=standout, d=bold, u=underlined, k=blink.
+ \e[4mcolor\e[24m is a pair of numbers separated by a period. The first
+ number selects the foreground color and the second selects the
+ background color of the text. A single number \e[4mN\e[24m is the same as
+ \e[4mN.M\e[24m, where \e[4mM\e[24m is the normal background color. \e[1mx \e[22mmay also be \e[1ma \e[22mto
+ toggle strict ANSI sequence rendering (SGR mode).
-e or --quit-at-eof
\e[1mCOPYRIGHT\e[0m
- Copyright (C) 1984-2015 Mark Nudelman
+ Copyright (C) 1984-2016 Mark Nudelman
less is part of the GNU project and is free software. You can redis-
tribute it and/or modify it under the terms of either (1) the GNU Gen-
- Version 481: 31 Aug 2015 LESS(1)
+ Version 487: 25 Oct 2016 LESS(1)
-.TH LESS 1 "Version 481: 31 Aug 2015"
+.TH LESS 1 "Version 487: 25 Oct 2016"
.SH NAME
less \- opposite of more
.SH SYNOPSIS
(see the \-# option).
If a number N is specified, it becomes the default for future RIGHTARROW
and LEFTARROW commands.
+.IP "ESC-} or ^RIGHTARROW"
+Scroll horizontally right to show the end of the longest displayed line.
+.IP "ESC-{ or ^LEFTARROW"
+Scroll horizontally left back to the first column.
.IP "r or ^R or ^L"
Repaint the screen.
.IP R
the background color of the text.
A single number \fIN\fP is the same as \fIN.M\fP,
where \fIM\fP is the normal background color.
+\fBx\fP may also be \fBa\fP to toggle strict ANSI sequence rendering (SGR mode).
.IP "\-e or \-\-quit-at-eof"
Causes
lesskey(1)
.SH COPYRIGHT
-Copyright (C) 1984-2015 Mark Nudelman
+Copyright (C) 1984-2016 Mark Nudelman
.PP
less is part of the GNU project and is free software.
You can redistribute it and/or modify it
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
- Version 481: 31 Aug 2015 LESSECHO(1)
+ Version 487: 25 Oct 2016 LESSECHO(1)
-.TH LESSECHO 1 "Version 481: 31 Aug 2015"
+.TH LESSECHO 1 "Version 487: 25 Oct 2016"
.SH NAME
lessecho \- expand metacharacters
.SH SYNOPSIS
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
{ "display-flag", A_DISP_OPTION },
{ "display-option", A_DISP_OPTION },
{ "end", A_GOEND },
+ { "end-scroll", A_RRSHIFT },
{ "examine", A_EXAMINE },
{ "filter", A_FILTER },
{ "first-cmd", A_FIRSTCMD },
{ "next-file", A_NEXT_FILE },
{ "next-tag", A_NEXT_TAG },
{ "noaction", A_NOACTION },
+ { "no-scroll", A_LLSHIFT },
{ "percent", A_PERCENT },
{ "pipe", A_PIPE },
{ "prev-file", A_PREV_FILE },
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
\n forw-line
e forw-line
j forw-line
- \kd forw-line
+ \kd forw-line
^E forw-line
^N forw-line
k back-line
^D forw-scroll
u back-scroll
^U back-scroll
- \40 forw-screen
+ \40 forw-screen
f forw-screen
^F forw-screen
^V forw-screen
- \kD forw-screen
+ \kD forw-screen
b back-screen
^B back-screen
\ev back-screen
- \kU back-screen
+ \kU back-screen
z forw-window
w back-window
\e\40 forw-screen-force
^L repaint
\eu undo-hilite
g goto-line
- \kh goto-line
+ \kh goto-line
< goto-line
\e< goto-line
p percent
\e) right-scroll
\kl left-scroll
\kr right-scroll
+ \e{ no-scroll
+ \e} end-scroll
{ forw-bracket {}
} back-bracket {}
( forw-bracket ()
G goto-end
\e> goto-end
> goto-end
- \ke goto-end
+ \ke goto-end
\eG goto-end-buffered
= status
^G status
\e[1mCOPYRIGHT\e[0m
- Copyright (C) 1984-2015 Mark Nudelman
+ Copyright (C) 1984-2016 Mark Nudelman
less is part of the GNU project and is free software. You can redis-
tribute it and/or modify it under the terms of either (1) the GNU Gen-
- Version 481: 31 Aug 2015 LESSKEY(1)
+ Version 487: 25 Oct 2016 LESSKEY(1)
-.TH LESSKEY 1 "Version 481: 31 Aug 2015"
+.TH LESSKEY 1 "Version 487: 25 Oct 2016"
.SH NAME
lesskey \- specify key bindings for less
.SH SYNOPSIS
\en forw-line
e forw-line
j forw-line
- \ekd forw-line
+ \ekd forw-line
^E forw-line
^N forw-line
k back-line
^D forw-scroll
u back-scroll
^U back-scroll
- \e40 forw-screen
+ \e40 forw-screen
f forw-screen
^F forw-screen
^V forw-screen
- \ekD forw-screen
+ \ekD forw-screen
b back-screen
^B back-screen
\eev back-screen
- \ekU back-screen
+ \ekU back-screen
z forw-window
w back-window
\ee\e40 forw-screen-force
^L repaint
\eeu undo-hilite
g goto-line
- \ekh goto-line
+ \ekh goto-line
< goto-line
\ee< goto-line
p percent
\ee) right-scroll
\ekl left-scroll
\ekr right-scroll
+ \ee{ no-scroll
+ \ee} end-scroll
{ forw-bracket {}
} back-bracket {}
( forw-bracket ()
G goto-end
\ee> goto-end
> goto-end
- \eke goto-end
+ \eke goto-end
\eeG goto-end-buffered
= status
^G status
This NUL character should be represented as \e340 in a lesskey file.
.SH COPYRIGHT
-Copyright (C) 1984-2015 Mark Nudelman
+Copyright (C) 1984-2016 Mark Nudelman
.PP
less is part of the GNU project and is free software.
You can redistribute it and/or modify it
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
#include "less.h"
#include "charset.h"
+#include "position.h"
static char *linebuf = NULL; /* Buffer which holds the current output line */
static char *attr = NULL; /* Extension of linebuf to hold attributes */
sprintf(linebuf+curr, "%*s ", n, buf);
n++; /* One space after the line number. */
for (i = 0; i < n; i++)
- attr[curr+i] = AT_NORMAL;
+ attr[curr+i] = AT_BOLD;
curr += n;
column += n;
lmargin += n;
*line_lenp = size_linebuf - 1 - n;
return (new_pos);
}
+
+/*
+ * Find the shift necessary to show the end of the longest displayed line.
+ */
+ public int
+rrshift()
+{
+ POSITION pos;
+ int save_width;
+ int line;
+ int longest = 0;
+
+ save_width = sc_width;
+ sc_width = INT_MAX;
+ hshift = 0;
+ pos = position(TOP);
+ for (line = 0; line < sc_height && pos != NULL_POSITION; line++)
+ {
+ pos = forw_line(pos);
+ if (column > longest)
+ longest = column;
+ }
+ sc_width = save_width;
+ if (longest < sc_width)
+ return 0;
+ return longest - sc_width;
+}
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
my $USAGE = <<__EOF__;
usage: mkutable [-n] [-f#] type... [--] [<] UnicodeData.txt
-n = take non-matching types
- -f = zero-based type field (default 2)
+ -f = zero-based type field (default 2)
__EOF__
use vars qw( $opt_f $opt_n );
use Getopt::Std;
my $type_field = 2;
-exit (main() ? 1 : 0);
+exit (main() ? 0 : 1);
sub main {
my $date = `date`;
$types{$arg} = 1;
}
my %out = ( 'types' => \%types );
- my $last_code = 0;
print $header;
+ my $last_code = 0;
while (<>) {
chomp;
s/#.*//;
my @fields = split /;/;
next if not @fields;
- my $code = hex $fields[0];
+ my ($lo_code, $hi_code);
+ my $codes = $fields[0];
+ if ($codes =~ /(\w+)\.\.(\w+)/) {
+ $lo_code = hex $1;
+ $hi_code = hex $2;
+ } else {
+ $lo_code = $hi_code = hex $fields[0];
+ }
my $type = $fields[$type_field];
$type =~ s/\s//g;
- while (++$last_code < $code) {
- output(\%out, $last_code, '?');
+ for ($last_code = $lo_code; $last_code <= $hi_code; ++$last_code) {
+ output(\%out, $last_code, $type);
}
- output(\%out, $code, $type);
}
- output(\%out, $last_code+1, '?');
+ output(\%out, $last_code);
+ return 1;
}
sub output {
my ($out, $code, $type) = @_;
- my $match = ${${$out}{types}}{$type};
- my $type_change = (not $$out{start_type} or $type ne $$out{start_type});
- $match = not $match if $opt_n;
- if ($match and (not $$out{in_run} or $type_change)) {
- end_run($out, $code-1);
+ my $type_ok = ($type and ${${$out}{types}}{$type});
+ $type_ok = not $type_ok if $opt_n;
+ my $prev_code = $$out{prev_code};
+
+ if (not $type_ok) {
+ end_run($out, $prev_code);
+ } elsif (not $$out{in_run} or $type ne $$out{run_type} or $code != $prev_code+1) {
+ end_run($out, $prev_code);
start_run($out, $code, $type);
- } elsif (not $match and $$out{in_run}) {
- end_run($out, $code-1);
}
+ $$out{prev_code} = $code;
}
sub start_run {
my ($out, $code, $type) = @_;
$$out{start_code} = $code;
- $$out{start_type} = $type;
+ $$out{prev_code} = $code;
+ $$out{run_type} = $type;
$$out{in_run} = 1;
}
sub end_run {
my ($out, $code) = @_;
return if not $$out{in_run};
- printf "\t{ 0x%04x, 0x%04x }, /* %s */\n", $$out{start_code}, $code, $$out{start_type};
+ printf "\t{ 0x%04x, 0x%04x }, /* %s */\n", $$out{start_code}, $code, $$out{run_type};
$$out{in_run} = 0;
}
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
extern int ul_fg_color, ul_bg_color;
extern int so_fg_color, so_bg_color;
extern int bl_fg_color, bl_bg_color;
+extern int sgr_mode;
#endif
putstr("no ");
#endif
putstr("regular expressions)\n");
- putstr("Copyright (C) 1984-2015 Mark Nudelman\n\n");
+ putstr("Copyright (C) 1984-2016 Mark Nudelman\n\n");
putstr("less comes with NO WARRANTY, to the extent permitted by law.\n");
putstr("For information about the terms of redistribution,\n");
putstr("see the file named README in the less distribution.\n");
int type;
char *s;
{
+ PARG p;
+
switch (type)
{
case INIT:
case 's':
colordesc(s, &so_fg_color, &so_bg_color);
break;
+ case 'a':
+ sgr_mode = !sgr_mode;
+ break;
default:
- error("-D must be followed by n, d, u, k or s", NULL_PARG);
+ error("-D must be followed by n, d, u, k, s or a", NULL_PARG);
break;
}
if (type == TOGGLE)
}
break;
case QUERY:
+ p.p_string = (sgr_mode) ? "on" : "off";
+ error("SGR mode is %s", &p);
break;
}
}
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
},
#if MSDOS_COMPILER
{ 'D', &D__optname,
- STRING|REPAINT|NO_QUERY, 0, NULL, opt_D,
+ STRING|REPAINT, 0, NULL, opt_D,
{
"color desc: ",
- "Ddknsu0123456789.",
+ "Dadknsu0123456789.",
NULL
}
},
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
extern int ul_fg_color, ul_bg_color;
extern int so_fg_color, so_bg_color;
extern int bl_fg_color, bl_bg_color;
+extern int sgr_mode;
#endif
/*
* the -D command-line option.
*/
char *anchor, *p, *p_next;
- unsigned char fg, bg;
+ static unsigned char fg, fgi, bg, bgi;
static unsigned char at;
+ unsigned char f, b;
#if MSDOS_COMPILER==WIN32C
/* Screen colors used by 3x and 4x SGR commands. */
static unsigned char screen_color[] = {
};
#endif
+ if (fg == 0 && bg == 0)
+ {
+ fg = nm_fg_color & 7;
+ fgi = nm_fg_color & 8;
+ bg = nm_bg_color & 7;
+ bgi = nm_bg_color & 8;
+ }
for (anchor = p_next = obuf;
(p_next = memchr(p_next, ESC, ob - p_next)) != NULL; )
{
*/
p++;
anchor = p_next = p;
- at = 0;
+ fg = nm_fg_color & 7;
+ fgi = nm_fg_color & 8;
+ bg = nm_bg_color & 7;
+ bgi = nm_bg_color & 8;
+ at = 0;
WIN32setcolors(nm_fg_color, nm_bg_color);
continue;
}
p_next = p;
+ at &= ~32;
/*
* Select foreground/background colors
* based on the escape sequence.
*/
- fg = nm_fg_color;
- bg = nm_bg_color;
while (!is_ansi_end(*p))
{
char *q;
break;
}
if (*q == ';')
+ {
q++;
+ at |= 32;
+ }
switch (code)
{
default:
/* case 0: all attrs off */
- fg = nm_fg_color;
- bg = nm_bg_color;
- at = 0;
+ fg = nm_fg_color & 7;
+ bg = nm_bg_color & 7;
+ at &= 32;
+ /*
+ * \e[0m use normal
+ * intensities, but
+ * \e[0;...m resets them
+ */
+ if (at & 32)
+ {
+ fgi = 0;
+ bgi = 0;
+ } else
+ {
+ fgi = nm_fg_color & 8;
+ bgi = nm_bg_color & 8;
+ }
break;
case 1: /* bold on */
+ fgi = 8;
at |= 1;
break;
case 3: /* italic on */
at |= 2;
break;
case 4: /* underline on */
+ bgi = 8;
at |= 4;
break;
case 5: /* slow blink on */
case 6: /* fast blink on */
+ bgi = 8;
at |= 8;
break;
case 8: /* concealed on */
- fg = (bg & 7) | 8;
+ at |= 16;
break;
case 22: /* bold off */
+ fgi = 0;
at &= ~1;
break;
case 23: /* italic off */
at &= ~2;
break;
case 24: /* underline off */
+ bgi = 0;
at &= ~4;
break;
+ case 28: /* concealed off */
+ at &= ~16;
+ break;
case 30: case 31: case 32:
case 33: case 34: case 35:
case 36: case 37:
- fg = (fg & 8) | (screen_color[code - 30]);
+ fg = screen_color[code - 30];
+ at |= 32;
break;
case 39: /* default fg */
- fg = nm_fg_color;
+ fg = nm_fg_color & 7;
+ at |= 32;
break;
case 40: case 41: case 42:
case 43: case 44: case 45:
case 46: case 47:
- bg = (bg & 8) | (screen_color[code - 40]);
+ bg = screen_color[code - 40];
+ at |= 32;
break;
- case 49: /* default fg */
- bg = nm_bg_color;
+ case 49: /* default bg */
+ bg = nm_bg_color & 7;
+ at |= 32;
break;
}
p = q;
}
if (!is_ansi_end(*p) || p == p_next)
break;
- if (at & 1)
+ /*
+ * In SGR mode, the ANSI sequence is
+ * always honored; otherwise if an attr
+ * is used by itself ("\e[1m" versus
+ * "\e[1;33m", for example), set the
+ * color assigned to that attribute.
+ */
+ if (sgr_mode || (at & 32))
{
- /*
- * If \e[1m use defined bold
- * color, else set intensity.
- */
- if (p[-2] == '[')
+ if (at & 2)
{
-#if MSDOS_COMPILER==WIN32C
- fg |= FOREGROUND_INTENSITY;
- bg |= BACKGROUND_INTENSITY;
-#else
- fg = bo_fg_color;
- bg = bo_bg_color;
-#endif
+ f = bg | bgi;
+ b = fg | fgi;
} else
- fg |= 8;
- } else if (at & 2)
- {
- fg = so_fg_color;
- bg = so_bg_color;
- } else if (at & 4)
- {
- fg = ul_fg_color;
- bg = ul_bg_color;
- } else if (at & 8)
+ {
+ f = fg | fgi;
+ b = bg | bgi;
+ }
+ } else
{
- fg = bl_fg_color;
- bg = bl_bg_color;
+ if (at & 1)
+ {
+ f = bo_fg_color;
+ b = bo_bg_color;
+ } else if (at & 2)
+ {
+ f = so_fg_color;
+ b = so_bg_color;
+ } else if (at & 4)
+ {
+ f = ul_fg_color;
+ b = ul_bg_color;
+ } else if (at & 8)
+ {
+ f = bl_fg_color;
+ b = bl_bg_color;
+ } else
+ {
+ f = nm_fg_color;
+ b = nm_bg_color;
+ }
}
- fg &= 0xf;
- bg &= 0xf;
- WIN32setcolors(fg, bg);
+ if (at & 16)
+ f = b ^ 8;
+ f &= 0xf;
+ b &= 0xf;
+ WIN32setcolors(f, b);
p_next = anchor = p + 1;
} else
p_next++;
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
public int bl_bg_color;
static int sy_fg_color; /* Color of system text (before less) */
static int sy_bg_color;
+public int sgr_mode; /* Honor ANSI sequences rather than using above */
#else
so_bg_color = 9;
bl_fg_color = 15;
bl_bg_color = 0;
+ sgr_mode = 0;
/*
* Get size of the screen.
static void
initcolor()
{
+#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC
+ intensevideo();
+#endif
SETCOLORS(nm_fg_color, nm_bg_color);
#if 0
/*
currentKey.scan = PCK_CTL_DELETE;
break;
}
+ } else if (ip.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED)
+ {
+ switch (currentKey.scan)
+ {
+ case PCK_SHIFT_TAB: /* tab */
+ currentKey.ascii = 0;
+ break;
+ }
}
+
return (TRUE);
}
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
}
#endif
-/*
- * Change the caseless-ness of searches.
- * Updates the internal search state to reflect a change in the -i flag.
- */
- public void
-chg_caseless()
-{
- if (!is_ucase_pattern)
- /*
- * Pattern did not have uppercase.
- * Just set the search caselessness to the global caselessness.
- */
- is_caseless = caseless;
- else
- /*
- * Pattern did have uppercase.
- * Discard the pattern; we can't change search caselessness now.
- */
- clear_pattern(&search_info);
-}
-
#if HILITE_SEARCH
/*
* Find matching text which is currently on screen and highlight it.
* Search does not include current screen.
*/
if (search_type & SRCH_FORW)
- linenum = BOTTOM_PLUS_ONE;
+ linenum = sc_height-1; /* BOTTOM_PLUS_ONE */
else
- linenum = TOP;
+ linenum = 0; /* TOP */
} else if (how_search == OPT_ONPLUS && !(search_type & SRCH_AFTER_TARGET))
{
/*
* Search includes all of displayed screen.
*/
if (search_type & SRCH_FORW)
- linenum = TOP;
+ linenum = 0; /* TOP */
else
- linenum = BOTTOM_PLUS_ONE;
+ linenum = sc_height-1; /* BOTTOM_PLUS_ONE */
} else
{
/*
}
/*
+ * Change the caseless-ness of searches.
+ * Updates the internal search state to reflect a change in the -i flag.
+ */
+ public void
+chg_caseless()
+{
+ if (!is_ucase_pattern)
+ /*
+ * Pattern did not have uppercase.
+ * Just set the search caselessness to the global caselessness.
+ */
+ is_caseless = caseless;
+ else
+ {
+ /*
+ * Pattern did have uppercase.
+ * Regenerate the pattern using the new state.
+ */
+ clear_pattern(&search_info);
+ hist_pattern(search_info.search_type);
+ }
+}
+
+/*
* Search for the n-th occurrence of a specified pattern,
* either forward or backward.
* Return the number of matches not yet found in this file
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
#if 0 /* allow entering arbitrary hex chars for testing */
/* ctrl-A followed by two hex chars makes a byte */
{
- int hex_in = 0;
- int hex_value = 0;
+ static int hex_in = 0;
+ static int hex_value = 0;
if (c == CONTROL('A'))
{
hex_in = 2;
-/* Generated by "./mkutable -f2 Cc Cf Cs Co Zl Zp -- unicode/UnicodeData.txt" on Mon Jul 14 16:21:22 PDT 2014 */
+/* Generated by "./mkutable -f2 Cc Cf Cs Co Zl Zp -- unicode/UnicodeData.txt" on Tue Sep 20 10:51:43 PDT 2016 */
{ 0x0000, 0x001f }, /* Cc */
{ 0x007f, 0x009f }, /* Cc */
{ 0x00ad, 0x00ad }, /* Cf */
{ 0x061c, 0x061c }, /* Cf */
{ 0x06dd, 0x06dd }, /* Cf */
{ 0x070f, 0x070f }, /* Cf */
+ { 0x08e2, 0x08e2 }, /* Cf */
{ 0x180e, 0x180e }, /* Cf */
{ 0x200b, 0x200f }, /* Cf */
{ 0x2028, 0x2028 }, /* Zl */
/*
- * Copyright (C) 1984-2015 Mark Nudelman
+ * Copyright (C) 1984-2016 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.
don't add FAKE_* files to cmd history.
v478 5/21/15 Fix nonportable pointer usage in hilite tree.
v479 7/6/15 Allow %% escapes in LESSOPEN variable.
-v480 7/24/15 Fix bug in no-regex searches; support MSVC v1900.
-v481 8/20/15 Fix broken -g option.
+v480 7/24/15 Fix bug in no-regex searches; support MSVC v1900.
+v481 8/20/15 Fix broken -g option.
+-----------------------------------------------------------------
+v482 2/25/16 Update Unicode database to "2015-06-16, 20:24:00 GMT [KW]".
+v483 2/27/16 Regenerate hilite when change search caselessness.
+ (Thanks to Jason Hood)
+ Fix bug when terminal has no "cm". (Thanks to Noel Cragg)
+v484 9/20/16 Update to Unicode 9.0.0 database.
+v485 10/21/16 Fix "nothing to search" bug when top/bottom line is empty;
+ Display line numbers in bold. (thanks to Jason Hood);
+ Fix incorrect display when entering double-width chars in
+ search string.
+v486 10/22/16 New commands ESC-{ and ESC-} to shift to start/end of
+ displayed lines; new option -Da in Windows version to
+ enable SGR mode (thanks to Jason Hood).
+v487 10/23/16 configure --help formatting.
*/
-char version[] = "481";
+char version[] = "487";
-/* Generated by "./mkutable -f1 W -- unicode/EastAsianWidth.txt" on Mon Jul 14 16:21:23 PDT 2014 */
- { 0x1100, 0x1100 }, /* W */
+/* Generated by "./mkutable -f1 W F -- unicode/EastAsianWidth.txt" on Tue Sep 20 10:51:43 PDT 2016 */
+ { 0x1100, 0x115f }, /* W */
+ { 0x231a, 0x231b }, /* W */
{ 0x2329, 0x232a }, /* W */
- { 0x2e80, 0x2e80 }, /* W */
- { 0x2e9b, 0x2e9b }, /* W */
- { 0x2f00, 0x2f00 }, /* W */
- { 0x2ff0, 0x2ff0 }, /* W */
- { 0x3001, 0x3001 }, /* W */
- { 0x3004, 0x3012 }, /* W */
- { 0x3014, 0x301e }, /* W */
- { 0x3020, 0x3021 }, /* W */
- { 0x302a, 0x302a }, /* W */
- { 0x302e, 0x302e }, /* W */
- { 0x3030, 0x3031 }, /* W */
- { 0x3036, 0x3036 }, /* W */
- { 0x3038, 0x3038 }, /* W */
- { 0x303b, 0x303e }, /* W */
- { 0x3041, 0x3041 }, /* W */
- { 0x3099, 0x3099 }, /* W */
- { 0x309b, 0x309b }, /* W */
- { 0x309d, 0x309d }, /* W */
- { 0x309f, 0x30a1 }, /* W */
- { 0x30fb, 0x30fc }, /* W */
- { 0x30ff, 0x30ff }, /* W */
- { 0x3105, 0x3105 }, /* W */
- { 0x3131, 0x3131 }, /* W */
- { 0x3190, 0x3190 }, /* W */
- { 0x3192, 0x3192 }, /* W */
- { 0x3196, 0x3196 }, /* W */
- { 0x31a0, 0x31a0 }, /* W */
- { 0x31c0, 0x31c0 }, /* W */
- { 0x31f0, 0x31f0 }, /* W */
- { 0x3200, 0x3200 }, /* W */
- { 0x3220, 0x3220 }, /* W */
- { 0x322a, 0x322a }, /* W */
- { 0x3250, 0x3251 }, /* W */
- { 0x3260, 0x3260 }, /* W */
- { 0x3280, 0x3280 }, /* W */
- { 0x328a, 0x328a }, /* W */
- { 0x32b1, 0x32b1 }, /* W */
- { 0x32c0, 0x32c0 }, /* W */
- { 0x3300, 0x3300 }, /* W */
- { 0x3400, 0x3400 }, /* W */
- { 0x4db6, 0x4db6 }, /* W */
- { 0x4e00, 0x4e00 }, /* W */
- { 0x9fcd, 0x9fcd }, /* W */
- { 0xa000, 0xa000 }, /* W */
- { 0xa015, 0xa016 }, /* W */
- { 0xa490, 0xa490 }, /* W */
- { 0xa960, 0xa960 }, /* W */
- { 0xac00, 0xac00 }, /* W */
- { 0xf900, 0xf900 }, /* W */
- { 0xfa6e, 0xfa6e }, /* W */
- { 0xfa70, 0xfa70 }, /* W */
- { 0xfada, 0xfada }, /* W */
- { 0xfe10, 0xfe10 }, /* W */
- { 0xfe17, 0xfe19 }, /* W */
- { 0xfe30, 0xfe31 }, /* W */
- { 0xfe33, 0xfe33 }, /* W */
- { 0xfe35, 0xfe45 }, /* W */
- { 0xfe47, 0xfe49 }, /* W */
- { 0xfe4d, 0xfe4d }, /* W */
- { 0xfe50, 0xfe50 }, /* W */
- { 0xfe54, 0xfe54 }, /* W */
- { 0xfe58, 0xfe5f }, /* W */
- { 0xfe62, 0xfe64 }, /* W */
- { 0xfe68, 0xfe6a }, /* W */
- { 0x1b000, 0x1b000 }, /* W */
- { 0x1f200, 0x1f200 }, /* W */
- { 0x1f210, 0x1f210 }, /* W */
- { 0x1f240, 0x1f240 }, /* W */
- { 0x1f250, 0x1f250 }, /* W */
- { 0x20000, 0x20000 }, /* W */
- { 0x2a6d7, 0x2a6d7 }, /* W */
- { 0x2a700, 0x2a700 }, /* W */
- { 0x2b735, 0x2b735 }, /* W */
- { 0x2b740, 0x2b740 }, /* W */
- { 0x2b81e, 0x2b81e }, /* W */
- { 0x2f800, 0x2f800 }, /* W */
- { 0x2fa1e, 0x2fa1e }, /* W */
- { 0x30000, 0x30000 }, /* W */
+ { 0x23e9, 0x23ec }, /* W */
+ { 0x23f0, 0x23f0 }, /* W */
+ { 0x23f3, 0x23f3 }, /* W */
+ { 0x25fd, 0x25fe }, /* W */
+ { 0x2614, 0x2615 }, /* W */
+ { 0x2648, 0x2653 }, /* W */
+ { 0x267f, 0x267f }, /* W */
+ { 0x2693, 0x2693 }, /* W */
+ { 0x26a1, 0x26a1 }, /* W */
+ { 0x26aa, 0x26ab }, /* W */
+ { 0x26bd, 0x26be }, /* W */
+ { 0x26c4, 0x26c5 }, /* W */
+ { 0x26ce, 0x26ce }, /* W */
+ { 0x26d4, 0x26d4 }, /* W */
+ { 0x26ea, 0x26ea }, /* W */
+ { 0x26f2, 0x26f3 }, /* W */
+ { 0x26f5, 0x26f5 }, /* W */
+ { 0x26fa, 0x26fa }, /* W */
+ { 0x26fd, 0x26fd }, /* W */
+ { 0x2705, 0x2705 }, /* W */
+ { 0x270a, 0x270b }, /* W */
+ { 0x2728, 0x2728 }, /* W */
+ { 0x274c, 0x274c }, /* W */
+ { 0x274e, 0x274e }, /* W */
+ { 0x2753, 0x2755 }, /* W */
+ { 0x2757, 0x2757 }, /* W */
+ { 0x2795, 0x2797 }, /* W */
+ { 0x27b0, 0x27b0 }, /* W */
+ { 0x27bf, 0x27bf }, /* W */
+ { 0x2b1b, 0x2b1c }, /* W */
+ { 0x2b50, 0x2b50 }, /* W */
+ { 0x2b55, 0x2b55 }, /* W */
+ { 0x2e80, 0x2e99 }, /* W */
+ { 0x2e9b, 0x2ef3 }, /* W */
+ { 0x2f00, 0x2fd5 }, /* W */
+ { 0x2ff0, 0x2ffb }, /* W */
+ { 0x3000, 0x3000 }, /* F */
+ { 0x3001, 0x303e }, /* W */
+ { 0x3041, 0x3096 }, /* W */
+ { 0x3099, 0x30ff }, /* W */
+ { 0x3105, 0x312d }, /* W */
+ { 0x3131, 0x318e }, /* W */
+ { 0x3190, 0x31ba }, /* W */
+ { 0x31c0, 0x31e3 }, /* W */
+ { 0x31f0, 0x321e }, /* W */
+ { 0x3220, 0x3247 }, /* W */
+ { 0x3250, 0x32fe }, /* W */
+ { 0x3300, 0x4dbf }, /* W */
+ { 0x4e00, 0xa48c }, /* W */
+ { 0xa490, 0xa4c6 }, /* W */
+ { 0xa960, 0xa97c }, /* W */
+ { 0xac00, 0xd7a3 }, /* W */
+ { 0xf900, 0xfaff }, /* W */
+ { 0xfe10, 0xfe19 }, /* W */
+ { 0xfe30, 0xfe52 }, /* W */
+ { 0xfe54, 0xfe66 }, /* W */
+ { 0xfe68, 0xfe6b }, /* W */
+ { 0xff01, 0xff60 }, /* F */
+ { 0xffe0, 0xffe6 }, /* F */
+ { 0x16fe0, 0x16fe0 }, /* W */
+ { 0x17000, 0x187ec }, /* W */
+ { 0x18800, 0x18af2 }, /* W */
+ { 0x1b000, 0x1b001 }, /* W */
+ { 0x1f004, 0x1f004 }, /* W */
+ { 0x1f0cf, 0x1f0cf }, /* W */
+ { 0x1f18e, 0x1f18e }, /* W */
+ { 0x1f191, 0x1f19a }, /* W */
+ { 0x1f200, 0x1f202 }, /* W */
+ { 0x1f210, 0x1f23b }, /* W */
+ { 0x1f240, 0x1f248 }, /* W */
+ { 0x1f250, 0x1f251 }, /* W */
+ { 0x1f300, 0x1f320 }, /* W */
+ { 0x1f32d, 0x1f335 }, /* W */
+ { 0x1f337, 0x1f37c }, /* W */
+ { 0x1f37e, 0x1f393 }, /* W */
+ { 0x1f3a0, 0x1f3ca }, /* W */
+ { 0x1f3cf, 0x1f3d3 }, /* W */
+ { 0x1f3e0, 0x1f3f0 }, /* W */
+ { 0x1f3f4, 0x1f3f4 }, /* W */
+ { 0x1f3f8, 0x1f43e }, /* W */
+ { 0x1f440, 0x1f440 }, /* W */
+ { 0x1f442, 0x1f4fc }, /* W */
+ { 0x1f4ff, 0x1f53d }, /* W */
+ { 0x1f54b, 0x1f54e }, /* W */
+ { 0x1f550, 0x1f567 }, /* W */
+ { 0x1f57a, 0x1f57a }, /* W */
+ { 0x1f595, 0x1f596 }, /* W */
+ { 0x1f5a4, 0x1f5a4 }, /* W */
+ { 0x1f5fb, 0x1f64f }, /* W */
+ { 0x1f680, 0x1f6c5 }, /* W */
+ { 0x1f6cc, 0x1f6cc }, /* W */
+ { 0x1f6d0, 0x1f6d2 }, /* W */
+ { 0x1f6eb, 0x1f6ec }, /* W */
+ { 0x1f6f4, 0x1f6f6 }, /* W */
+ { 0x1f910, 0x1f91e }, /* W */
+ { 0x1f920, 0x1f927 }, /* W */
+ { 0x1f930, 0x1f930 }, /* W */
+ { 0x1f933, 0x1f93e }, /* W */
+ { 0x1f940, 0x1f94b }, /* W */
+ { 0x1f950, 0x1f95e }, /* W */
+ { 0x1f980, 0x1f991 }, /* W */
+ { 0x1f9c0, 0x1f9c0 }, /* W */
+ { 0x20000, 0x2fffd }, /* W */
+ { 0x30000, 0x3fffd }, /* W */