Date: Mon, 19 Apr 2021 01:16:49 GMT From: Xin LI <delphij@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org Subject: git: 1737d9dd586f - vendor/less - Vendor import of less v581. Message-ID: <202104190116.13J1Gnb5058461@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch vendor/less has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=1737d9dd586fd32916293643b7b06c088f8c22e7 commit 1737d9dd586fd32916293643b7b06c088f8c22e7 Author: Xin LI <delphij@FreeBSD.org> AuthorDate: 2021-04-19 01:15:19 +0000 Commit: Xin LI <delphij@FreeBSD.org> CommitDate: 2021-04-19 01:15:19 +0000 Vendor import of less v581. --- INSTALL | 10 +- Makefile.aut | 18 +- Makefile.wng | 132 +++++++ Makefile.wnm | 2 +- NEWS | 50 ++- README | 38 +- brac.c | 2 +- ch.c | 54 ++- charset.c | 154 ++++---- charset.h | 2 +- cmd.h | 20 +- cmdbuf.c | 87 ++-- command.c | 189 ++++++--- configure | 4 +- configure.ac | 4 +- cvt.c | 12 +- decode.c | 367 ++++++++--------- defines.ds | 2 +- defines.h.in | 12 + defines.o2 | 2 +- defines.o9 | 2 +- defines.wn | 2 +- edit.c | 33 +- filename.c | 29 +- forwback.c | 11 +- funcs.h | 35 +- help.c | 24 +- ifile.c | 39 +- input.c | 45 ++- jump.c | 2 +- less.h | 419 +++++++++++--------- less.hlp | 22 +- less.man | 1244 ++++++++++++++++++++++++++++++++-------------------------- less.nro | 204 ++++++++-- lessecho.c | 14 +- lessecho.man | 6 +- lessecho.nro | 8 +- lesskey.c | 163 ++++---- lesskey.h | 38 +- lesskey.man | 71 ++-- lesskey.nro | 25 +- lglob.h | 110 +++--- line.c | 905 ++++++++++++++++++++++++------------------ linenum.c | 31 +- lsystem.c | 44 ++- main.c | 84 ++-- mark.c | 26 +- mkfuncs.pl | 0 mkfuncs.py | 26 ++ mkhelp.py | 36 ++ optfunc.c | 309 +++++++++++---- option.c | 25 +- option.h | 62 +-- opttbl.c | 154 +++++--- os.c | 94 ++++- output.c | 612 +++++++++++++++-------------- pattern.c | 11 +- pattern.h | 18 +- pckeys.h | 38 +- position.c | 12 +- position.h | 12 +- prompt.c | 88 ++--- regexp.h | 14 +- screen.c | 780 ++++++++++++++++++++++++++---------- scrsize.c | 2 +- search.c | 359 +++++++++++++---- signal.c | 11 +- tags.c | 77 ++-- ttyin.c | 51 ++- version.c | 29 +- 70 files changed, 4716 insertions(+), 2901 deletions(-) diff --git a/INSTALL b/INSTALL index c2ab230e4470..78ae93246d88 100644 --- a/INSTALL +++ b/INSTALL @@ -1,6 +1,6 @@ - This file describes how to build and install less using -the "configure" script. This only works on Unix systems. -To install on other systems, read the README file. +This file contains generic instructions on how to build and +install software using autoconf. For specific instructions +on how to build "less", see the README or README.VER file. Basic Installation @@ -24,8 +24,8 @@ diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change + The file `configure.ac' is used to create `configure' by a program +called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: diff --git a/Makefile.aut b/Makefile.aut index 89309b583e2a..b6f2101cf10f 100644 --- a/Makefile.aut +++ b/Makefile.aut @@ -1,13 +1,21 @@ # Makefile for authoring less. EMAIL = bug-less@gnu.org -HOMEPAGE = http://www.greenwoodsoftware.com/less +HOMEPAGE = https://greenwoodsoftware.com/less SHELL = /bin/sh GIT = git NROFF = nroff -t -man srcdir = . +ifeq ($(USE_PYTHON),1) + MKHELP = mkhelp.py + MKFUNCS = mkfuncs.py +else + MKHELP = mkhelp.pl + MKFUNCS = mkfuncs.pl +endif + SRC = \ main.c screen.c brac.c ch.c charset.c cmdbuf.c \ command.c cvt.c decode.c edit.c filename.c forwback.c \ @@ -19,7 +27,7 @@ DISTFILES_W = \ defines.ds Makefile.dsb Makefile.dsg Makefile.dsu \ defines.o2 Makefile.o2e \ defines.o9 Makefile.o9c Makefile.o9u \ - defines.wn Makefile.wnm Makefile.wnb \ + defines.wn Makefile.wnm Makefile.wnb Makefile.wng \ configure UNICODE_FILES = \ compose.uni fmt.uni ubin.uni wide.uni @@ -33,6 +41,7 @@ DISTFILES = \ less.nro less.man lesskey.nro lesskey.man lessecho.nro lessecho.man \ less.hlp \ mkfuncs.pl mkhelp.pl \ + mkfuncs.py mkhelp.py \ mkutable $(UNICODE_FILES) \ ${DISTFILES_W} @@ -49,7 +58,7 @@ release: .FORCE help.c: less.hlp -mv -f ${srcdir}/help.c ${srcdir}/help.c.old rm -rf help.c - ${srcdir}/mkhelp.pl < less.hlp > help.c + ${srcdir}/${MKHELP} < less.hlp > help.c if cmp -s help.c help.c.old; then mv -f help.c.old help.c; fi ${srcdir}/configure ${srcdir}/defines.h.in: ${srcdir}/configure.ac ${srcdir}/Makefile.in @@ -57,7 +66,7 @@ ${srcdir}/configure ${srcdir}/defines.h.in: ${srcdir}/configure.ac ${srcdir}/Mak funcs.h: ${SRC:%=${srcdir}/%} -mv -f ${srcdir}/funcs.h ${srcdir}/funcs.h.old - perl ${srcdir}/mkfuncs.pl ${SRC:%=${srcdir}/%} >${srcdir}/funcs.h + ${srcdir}/${MKFUNCS} ${SRC:%=${srcdir}/%} >${srcdir}/funcs.h if cmp -s funcs.h funcs.h.old; then mv -f funcs.h.old funcs.h; fi lint: @@ -80,7 +89,6 @@ REPLACE_VERSION = \ sed \ -e "s;@@VERSION@@;$$REL;" \ -e "s;@@DATE@@;$$DT;" \ - -e "s;@@EMAIL@@;${EMAIL};" \ -e "s;@@HOMEPAGE@@;${HOMEPAGE};" >$@ ${srcdir}/README: ${srcdir}/README.VER ${srcdir}/version.c diff --git a/Makefile.wng b/Makefile.wng new file mode 100644 index 000000000000..85686068c57b --- /dev/null +++ b/Makefile.wng @@ -0,0 +1,132 @@ +# Makefile for less using mingw-w64 package: +# http://mingw-w64.org/doku.php +# +# Derived from Makefile.wnm +# +# Usage: mingw32-make -f Makefile.wng [REGEX_PACKAGE={posix|gnu|regcomp-local}] +# +# The optional command line parameter "REGEX_PACKAGE" is used to specify +# a regular expression package for compilation and linking. This parameter +# can assume one of three values. +# +# REGEX_PACKAGE == regcomp-local +# This choice selects the regular expression package written by Henry +# Spencer. It is implemented by the repository file "regexp.c". +# +# REGEX_PACKAGE == posix +# This choice selects the POSIX implementation and is provided by MingW. +# This is the default choice. +# +# REGEX_PACKAGE == gnu +# This choice selects the GNU implementation and is provided by MingW. +# + +#### Start of system configuration section. #### + +CC = gcc + +# Definitions specific to mingw +# +MINGW_DEFINES = -DMINGW -DWIN32 + +# This specifies the "root" directory of the MingW installation. +# It is defined so that the compiler and linker can find the header files +# and library that provide regular expression support. +# +MINGW_ROOT_PATH = /mingw-w64/mingw64 + +# Determine the regular expression package to be used. +# +REGEX_PACKAGE ?= posix +ifeq (${REGEX_PACKAGE},regcomp-local) + MINGW_DEFINES += -DUSE_REGEXP_C +else ifeq (${REGEX_PACKAGE},posix) + MINGW_DEFINES += -DUSE_POSIX_REGCOMP +else ifeq (${REGEX_PACKAGE},gnu) + MINGW_DEFINES += -DUSE_GNU_REGEX +else + $(error REGEX_PACKAGE must be posix, gnu or regcomp-local) +endif + +MINGW_REGEX_IPATH = -I${MINGW_ROOT_PATH}/opt/include +MINGW_REGEX_LPATH = -L${MINGW_ROOT_PATH}/opt/lib +MINGW_REGEX_LIB = -lregex + +CFLAGS_MINGW = ${MINGW_DEFINES} +ifneq (${REGEX_PACKAGE},regcomp-local) +CFLAGS_MINGW += ${MINGW_REGEX_IPATH} +endif + +# MingW may use sh.exe instead of cmd.exe. +# Make sure it does not. +# +SHELL = cmd.exe + +CFLAGS = -O2 ${CFLAGS_MINGW} +ifneq (${REGEX_PACKAGE},regcomp-local) +LDFLAGS = ${MINGW_REGEX_LPATH} +LIBS = ${MINGW_REGEX_LIB} +endif + +#### End of system configuration section. #### + +# This rule allows us to supply the necessary -D options +# in addition to whatever the user asks for. +.c.o: + ${CC} -c -I. ${CFLAGS} $< + +LESS_SRC = brac.c ch.c charset.c cmdbuf.c command.c \ + cvt.c decode.c edit.c filename.c forwback.c \ + ifile.c input.c jump.c line.c linenum.c \ + lsystem.c main.c mark.c optfunc.c option.c \ + opttbl.c os.c output.c pattern.c position.c \ + prompt.c screen.c scrsize.c search.c \ + signal.c tags.c ttyin.c version.c +ifeq (${REGEX_PACKAGE},regcomp-local) +LESS_SRC += regexp.c +endif + +OBJ = \ + main.o screen.o brac.o ch.o charset.o cmdbuf.o \ + command.o cvt.o decode.o edit.o filename.o forwback.o \ + help.o ifile.o input.o jump.o line.o linenum.o \ + lsystem.o mark.o optfunc.o option.o opttbl.o os.o \ + output.o pattern.o position.o prompt.o search.o signal.o \ + tags.o ttyin.o version.o +ifeq (${REGEX_PACKAGE},regcomp-local) +OBJ += regexp.o +endif + + +all: clean less lesskey lessecho + +less: ${OBJ} + ${CC} ${LDFLAGS} -o $@ ${OBJ} ${LIBS} + +lesskey: lesskey.o version.o + ${CC} ${LDFLAGS} -o $@ lesskey.o version.o + +lessecho: lessecho.o version.o + ${CC} ${LDFLAGS} -o $@ lessecho.o version.o + +defines.h: defines.wn + copy $< $@ + +funcs.h: + perl mkfuncs.pl ${LESS_SRC} > $@ + +help.c: less.hlp + perl mkhelp.pl < $< > $@ + +${OBJ}: less.h defines.h funcs.h + +TAGS: + etags *.c *.h + +clean: + -del *.o + -del *.exe + -del defines.h + -del funcs.h + -del help.c + -if exist TAGS del TAGS diff --git a/Makefile.wnm b/Makefile.wnm index 358fa9fed186..cc084a7c96b9 100644 --- a/Makefile.wnm +++ b/Makefile.wnm @@ -6,7 +6,7 @@ CC = cl # Normal flags -CFLAGS = /nologo /MD /W3 /EHsc /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c +CFLAGS = /nologo /W3 /EHsc /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c LDFLAGS = /nologo /subsystem:console /incremental:no # Debugging flags diff --git a/NEWS b/NEWS index b0644fd2e0de..fd214e62007d 100644 --- a/NEWS +++ b/NEWS @@ -4,10 +4,56 @@ ====================================================================== For the latest news about less, see the "less" Web page: - http://www.greenwoodsoftware.com/less + https://greenwoodsoftware.com/less You can also download the latest version of less from there. - To report bugs, suggestions or comments, send email to bug-less@gnu.org + Report bugs, suggestions or comments at + https://github.com/gwsw/less/issues. + +====================================================================== + + Major changes between "less" versions 563 and 581 + +* Change ESC-u command to toggle, not disable, highlighting per man page. + +* Add ESC-U command. + +* Add ctrl-W search modifier for wrapping search. + +* F command can be interrupted by ^X. + +* Support OSC 8 hyperlinks when -R is in effect. + +* g command with no number will ignore -j and put first line at top of screen. + +* Multiple + or -p command line options are handled better. + +* Add the --incsearch option. + +* Add the --line-num-width option. + +* Add the --status-col-width option. + +* Add the --use-color and --color options. + +* Display -w highlight even if highlighted line is empty. + +* If search result is in a long line, scroll to ensure it is visible. + +* Editing the same file under different names now creates only + one entry in the file list. + +* Make visual bell more visible on some terminals. + +* Ring end-of-file bell no more than once per second. + +* Build can use either Python or Perl for Makefile.aut operations. + +* Fix crash when using the @ search modifier. + +* Fix crash in the 's' command due to duplicate free. + +* Fix realpath crash on Darwin. ====================================================================== diff --git a/README b/README index a6ee1dfa62a4..c99d208960cc 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ - Less, version 563 + Less, version 581 - This is the distribution of less, version 563, released 13 Jun 2020. + This is the distribution of less, version 581, released 06 Apr 2021. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or @@ -13,33 +13,29 @@ or 2. The Less License, in the file LICENSE. - Please report any problems to bug-less@gnu.org. - See http://www.greenwoodsoftware.com/less for the latest info. + Please report any problems at https://github.com/gwsw/less/issues. + See https://greenwoodsoftware.com/less for the latest info. Source repository is at https://github.com/gwsw/less.git. ========================================================================= -This is the distribution of "less", a paginator similar to "more" or "pg". - The formatted manual page is in less.man. The manual page nroff source is in less.nro. Major changes made since the last posted version are in NEWS. ======================================================================= -PRE-INSTALLATION (when using git) - -If you are building from a clone of a git repository, -type "make -f Makefile.aut". -If you are building from a numbered release package (a tar or zip file -with a name like less-999.tar.gz or less-999.zip), you should skip this step. - -======================================================================= -INSTALLATION (Unix systems only): +INSTALLATION (Unix & Linux systems only): 1. Move the distributed source to its own directory and unpack it, if you have not already done so. -2. Type "sh configure". +2. If you are building from a clone of a git repository, + type "make -f Makefile.aut". + If you are building from a numbered release package (a tar or + zip file with a name like less-999.tar.gz or less-999.zip downloaded + from greenwoodsoftware.com, not from github), you should skip this step. + +3. Type "sh configure". This will generate a Makefile and a defines.h. Warning: if you have a GNU sed, make sure it is version 2.05 or later. @@ -71,7 +67,7 @@ INSTALLATION (Unix systems only): commands, etc. -3. It is a good idea to look over the generated Makefile and defines.h +4. It is a good idea to look over the generated Makefile and defines.h and make sure they look ok. If you know of any peculiarities of your system that configure might not have detected, you may fix the Makefile now. Take particular notice of the list of "terminal" @@ -85,13 +81,13 @@ INSTALLATION (Unix systems only): to remove the descriptions of the features which you are removing. If you edit less.hlp, you should run "make -f Makefile.aut help.c". -4. Type "make" and watch the fun. +5. Type "make" and watch the fun. -5. If the make succeeds, it will generate the programs "less", +6. If the make succeeds, it will generate the programs "less", "lesskey" and "lessecho" in your current directory. Test the generated programs. -6. When satisfied that it works, if you wish to install it +7. When satisfied that it works, if you wish to install it in a public place, type "make install". The default install destinations are: @@ -100,8 +96,6 @@ INSTALLATION (Unix systems only): If you want to install any of these files elsewhere, define bindir and/or mandir to the appropriate directories. -If you have any problems building or running "less", suggestions, -complaints, etc., you may mail to bug-less@gnu.org. Note to hackers: comments noting possible improvements are enclosed in double curly brackets {{ like this }}. diff --git a/brac.c b/brac.c index db3a2951db08..53ada50aab56 100644 --- a/brac.c +++ b/brac.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/ch.c b/ch.c index 70fad1002dbf..bab0692f7437 100644 --- a/ch.c +++ b/ch.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 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. @@ -41,7 +41,7 @@ struct bufnode { struct bufnode *hnext, *hprev; }; -#define LBUFSIZE 8192 +#define LBUFSIZE 8192 struct buf { struct bufnode node; BLOCKNUM block; @@ -54,7 +54,7 @@ struct buf { * The file state is maintained in a filestate structure. * A pointer to the filestate is kept in the ifile structure. */ -#define BUFHASH_SIZE 1024 +#define BUFHASH_SIZE 1024 struct filestate { struct bufnode buflist; struct bufnode hashtbl[BUFHASH_SIZE]; @@ -67,24 +67,24 @@ struct filestate { POSITION fsize; }; -#define ch_bufhead thisfile->buflist.next -#define ch_buftail thisfile->buflist.prev -#define ch_nbufs thisfile->nbufs -#define ch_block thisfile->block -#define ch_offset thisfile->offset -#define ch_fpos thisfile->fpos -#define ch_fsize thisfile->fsize -#define ch_flags thisfile->flags -#define ch_file thisfile->file +#define ch_bufhead thisfile->buflist.next +#define ch_buftail thisfile->buflist.prev +#define ch_nbufs thisfile->nbufs +#define ch_block thisfile->block +#define ch_offset thisfile->offset +#define ch_fpos thisfile->fpos +#define ch_fsize thisfile->fsize +#define ch_flags thisfile->flags +#define ch_file thisfile->file -#define END_OF_CHAIN (&thisfile->buflist) -#define END_OF_HCHAIN(h) (&thisfile->hashtbl[h]) -#define BUFHASH(blk) ((blk) & (BUFHASH_SIZE-1)) +#define END_OF_CHAIN (&thisfile->buflist) +#define END_OF_HCHAIN(h) (&thisfile->hashtbl[h]) +#define BUFHASH(blk) ((blk) & (BUFHASH_SIZE-1)) /* * Macros to manipulate the list of buffers in thisfile->buflist. */ -#define FOR_BUFS(bn) \ +#define FOR_BUFS(bn) \ for (bn = ch_bufhead; bn != END_OF_CHAIN; bn = bn->next) #define BUF_RM(bn) \ @@ -106,15 +106,15 @@ struct filestate { /* * Macros to manipulate the list of buffers in thisfile->hashtbl[n]. */ -#define FOR_BUFS_IN_CHAIN(h,bn) \ +#define FOR_BUFS_IN_CHAIN(h,bn) \ for (bn = thisfile->hashtbl[h].hnext; \ bn != END_OF_HCHAIN(h); bn = bn->hnext) -#define BUF_HASH_RM(bn) \ +#define BUF_HASH_RM(bn) \ (bn)->hnext->hprev = (bn)->hprev; \ (bn)->hprev->hnext = (bn)->hnext; -#define BUF_HASH_INS(bn,h) \ +#define BUF_HASH_INS(bn,h) \ (bn)->hnext = thisfile->hashtbl[h].hnext; \ (bn)->hprev = END_OF_HCHAIN(h); \ thisfile->hashtbl[h].hnext->hprev = (bn); \ @@ -240,12 +240,12 @@ ch_get(VOID_PARAM) return ('?'); if (lseek(ch_file, (off_t)pos, SEEK_SET) == BAD_LSEEK) { - error("seek error", NULL_PARG); + error("seek error", NULL_PARG); clear_eol(); return (EOI); - } - ch_fpos = pos; - } + } + ch_fpos = pos; + } /* * Read the block. @@ -311,13 +311,7 @@ ch_get(VOID_PARAM) parg.p_string = wait_message(); ierror("%s", &parg); } -#if !MSDOS_COMPILER - sleep(1); -#else -#if MSDOS_COMPILER==WIN32C - Sleep(1000); -#endif -#endif + sleep_ms(2); /* Reduce system load */ slept = TRUE; #if HAVE_STAT_INO diff --git a/charset.c b/charset.c index 4897cbaf6adc..b37c8a29cbd9 100644 --- a/charset.c +++ b/charset.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 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. @@ -40,27 +40,27 @@ struct charset { int *p_flag; char *desc; } charsets[] = { - { "ascii", NULL, "8bcccbcc18b95.b" }, - { "utf-8", &utf_mode, "8bcccbcc18b95.b126.bb" }, - { "iso8859", NULL, "8bcccbcc18b95.33b." }, - { "latin3", NULL, "8bcccbcc18b95.33b5.b8.b15.b4.b12.b18.b12.b." }, - { "arabic", NULL, "8bcccbcc18b95.33b.3b.7b2.13b.3b.b26.5b19.b" }, - { "greek", NULL, "8bcccbcc18b95.33b4.2b4.b3.b35.b44.b" }, - { "greek2005", NULL, "8bcccbcc18b95.33b14.b35.b44.b" }, - { "hebrew", NULL, "8bcccbcc18b95.33b.b29.32b28.2b2.b" }, - { "koi8-r", NULL, "8bcccbcc18b95.b." }, - { "KOI8-T", NULL, "8bcccbcc18b95.b8.b6.b8.b.b.5b7.3b4.b4.b3.b.b.3b." }, - { "georgianps", NULL, "8bcccbcc18b95.3b11.4b12.2b." }, - { "tcvn", NULL, "b..b...bcccbccbbb7.8b95.b48.5b." }, - { "TIS-620", NULL, "8bcccbcc18b95.b.4b.11b7.8b." }, - { "next", NULL, "8bcccbcc18b95.bb125.bb" }, - { "dos", NULL, "8bcccbcc12bc5b95.b." }, - { "windows-1251", NULL, "8bcccbcc12bc5b95.b24.b." }, - { "windows-1252", NULL, "8bcccbcc12bc5b95.b.b11.b.2b12.b." }, - { "windows-1255", NULL, "8bcccbcc12bc5b95.b.b8.b.5b9.b.4b." }, - { "ebcdic", NULL, "5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b." }, - { "IBM-1047", NULL, "4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc191.b" }, - { NULL, NULL, NULL } + { "ascii", NULL, "8bcccbcc18b95.b" }, + { "utf-8", &utf_mode, "8bcccbcc18b95.b126.bb" }, + { "iso8859", NULL, "8bcccbcc18b95.33b." }, + { "latin3", NULL, "8bcccbcc18b95.33b5.b8.b15.b4.b12.b18.b12.b." }, + { "arabic", NULL, "8bcccbcc18b95.33b.3b.7b2.13b.3b.b26.5b19.b" }, + { "greek", NULL, "8bcccbcc18b95.33b4.2b4.b3.b35.b44.b" }, + { "greek2005", NULL, "8bcccbcc18b95.33b14.b35.b44.b" }, + { "hebrew", NULL, "8bcccbcc18b95.33b.b29.32b28.2b2.b" }, + { "koi8-r", NULL, "8bcccbcc18b95.b." }, + { "KOI8-T", NULL, "8bcccbcc18b95.b8.b6.b8.b.b.5b7.3b4.b4.b3.b.b.3b." }, + { "georgianps", NULL, "8bcccbcc18b95.3b11.4b12.2b." }, + { "tcvn", NULL, "b..b...bcccbccbbb7.8b95.b48.5b." }, + { "TIS-620", NULL, "8bcccbcc18b95.b.4b.11b7.8b." }, + { "next", NULL, "8bcccbcc18b95.bb125.bb" }, + { "dos", NULL, "8bcccbcc12bc5b95.b." }, + { "windows-1251", NULL, "8bcccbcc12bc5b95.b24.b." }, + { "windows-1252", NULL, "8bcccbcc12bc5b95.b.b11.b.2b12.b." }, + { "windows-1255", NULL, "8bcccbcc12bc5b95.b.b8.b.5b9.b.4b." }, + { "ebcdic", NULL, "5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b." }, + { "IBM-1047", NULL, "4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc191.b" }, + { NULL, NULL, NULL } }; /* @@ -70,58 +70,58 @@ struct cs_alias { char *name; char *oname; } cs_aliases[] = { - { "UTF-8", "utf-8" }, - { "utf8", "utf-8" }, - { "UTF8", "utf-8" }, - { "ANSI_X3.4-1968", "ascii" }, - { "US-ASCII", "ascii" }, - { "latin1", "iso8859" }, - { "ISO-8859-1", "iso8859" }, - { "latin9", "iso8859" }, - { "ISO-8859-15", "iso8859" }, - { "latin2", "iso8859" }, - { "ISO-8859-2", "iso8859" }, - { "ISO-8859-3", "latin3" }, - { "latin4", "iso8859" }, - { "ISO-8859-4", "iso8859" }, - { "cyrillic", "iso8859" }, - { "ISO-8859-5", "iso8859" }, - { "ISO-8859-6", "arabic" }, - { "ISO-8859-7", "greek" }, - { "IBM9005", "greek2005" }, - { "ISO-8859-8", "hebrew" }, - { "latin5", "iso8859" }, - { "ISO-8859-9", "iso8859" }, - { "latin6", "iso8859" }, - { "ISO-8859-10", "iso8859" }, - { "latin7", "iso8859" }, - { "ISO-8859-13", "iso8859" }, - { "latin8", "iso8859" }, - { "ISO-8859-14", "iso8859" }, - { "latin10", "iso8859" }, - { "ISO-8859-16", "iso8859" }, - { "IBM437", "dos" }, - { "EBCDIC-US", "ebcdic" }, - { "IBM1047", "IBM-1047" }, - { "KOI8-R", "koi8-r" }, - { "KOI8-U", "koi8-r" }, - { "GEORGIAN-PS", "georgianps" }, - { "TCVN5712-1", "tcvn" }, - { "NEXTSTEP", "next" }, - { "windows", "windows-1252" }, /* backward compatibility */ - { "CP1251", "windows-1251" }, - { "CP1252", "windows-1252" }, - { "CP1255", "windows-1255" }, + { "UTF-8", "utf-8" }, + { "utf8", "utf-8" }, + { "UTF8", "utf-8" }, + { "ANSI_X3.4-1968", "ascii" }, + { "US-ASCII", "ascii" }, + { "latin1", "iso8859" }, + { "ISO-8859-1", "iso8859" }, + { "latin9", "iso8859" }, + { "ISO-8859-15", "iso8859" }, + { "latin2", "iso8859" }, + { "ISO-8859-2", "iso8859" }, + { "ISO-8859-3", "latin3" }, + { "latin4", "iso8859" }, + { "ISO-8859-4", "iso8859" }, + { "cyrillic", "iso8859" }, + { "ISO-8859-5", "iso8859" }, + { "ISO-8859-6", "arabic" }, + { "ISO-8859-7", "greek" }, + { "IBM9005", "greek2005" }, + { "ISO-8859-8", "hebrew" }, + { "latin5", "iso8859" }, + { "ISO-8859-9", "iso8859" }, + { "latin6", "iso8859" }, + { "ISO-8859-10", "iso8859" }, + { "latin7", "iso8859" }, + { "ISO-8859-13", "iso8859" }, + { "latin8", "iso8859" }, + { "ISO-8859-14", "iso8859" }, + { "latin10", "iso8859" }, + { "ISO-8859-16", "iso8859" }, + { "IBM437", "dos" }, + { "EBCDIC-US", "ebcdic" }, + { "IBM1047", "IBM-1047" }, + { "KOI8-R", "koi8-r" }, + { "KOI8-U", "koi8-r" }, + { "GEORGIAN-PS", "georgianps" }, + { "TCVN5712-1", "tcvn" }, + { "NEXTSTEP", "next" }, + { "windows", "windows-1252" }, /* backward compatibility */ + { "CP1251", "windows-1251" }, + { "CP1252", "windows-1252" }, + { "CP1255", "windows-1255" }, { NULL, NULL } }; -#define IS_BINARY_CHAR 01 -#define IS_CONTROL_CHAR 02 +#define IS_BINARY_CHAR 01 +#define IS_CONTROL_CHAR 02 static char chardef[256]; static char *binfmt = NULL; static char *utfbinfmt = NULL; -public int binattr = AT_STANDOUT; +public int binattr = AT_STANDOUT|AT_COLOR_BIN; /* @@ -134,9 +134,9 @@ public int binattr = AT_STANDOUT; * repetition of the letter. * * Each letter is one of: - * . normal character - * b binary character - * c control character + * . normal character + * b binary character + * c control character */ static void ichardef(s) @@ -457,16 +457,16 @@ prchar(c) SNPRINTF1(buf, sizeof(buf), "^%c", /* * This array roughly inverts CONTROL() #defined in less.h, - * and should be kept in sync with CONTROL() and IBM-1047. - */ + * and should be kept in sync with CONTROL() and IBM-1047. + */ "@ABC.I.?...KLMNO" "PQRS.JH.XY.." "\\]^_" "......W[.....EFG" "..V....D....TU.Z"[c]); #else - else if (c < 128 && !control_char(c ^ 0100)) - SNPRINTF1(buf, sizeof(buf), "^%c", (int) (c ^ 0100)); + else if (c < 128 && !control_char(c ^ 0100)) + SNPRINTF1(buf, sizeof(buf), "^%c", (int) (c ^ 0100)); #endif else SNPRINTF1(buf, sizeof(buf), binfmt, c); @@ -484,7 +484,7 @@ prutfchar(ch) if (ch == ESC) strcpy(buf, "ESC"); - else if (ch < 128 && control_char(ch)) + else if (ch < 128 && control_char(ch)) { if (!control_char(ch ^ 0100)) SNPRINTF1(buf, sizeof(buf), "^%c", ((char) ch) ^ 0100); @@ -732,9 +732,9 @@ step_char(pp, dir, limit) */ #define DECLARE_RANGE_TABLE_START(name) \ - static struct wchar_range name##_array[] = { + static struct wchar_range name##_array[] = { #define DECLARE_RANGE_TABLE_END(name) \ - }; struct wchar_range_table name##_table = { name##_array, sizeof(name##_array)/sizeof(*name##_array) }; + }; struct wchar_range_table name##_table = { name##_array, sizeof(name##_array)/sizeof(*name##_array) }; DECLARE_RANGE_TABLE_START(compose) #include "compose.uni" diff --git a/charset.h b/charset.h index cc0c3af59e89..3e7ecf73db94 100644 --- a/charset.h +++ b/charset.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/cmd.h b/cmd.h index 95a2e5801717..c51f0bc5c4f3 100644 --- a/cmd.h +++ b/cmd.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 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. @@ -31,7 +31,6 @@ #define A_HELP 19 #define A_NEXT_FILE 20 #define A_PERCENT 21 -#define A_PREFIX 22 #define A_PREV_FILE 23 #define A_QUIT 24 #define A_REPAINT 25 @@ -72,19 +71,19 @@ #define A_CLRMARK 62 #define A_SETMARKBOT 63 #define A_X11MOUSE_IN 64 -#define A_X11MOUSE_IGNORE 65 #define A_F_MOUSE 66 #define A_B_MOUSE 67 /* Note "X116" refers to extended (1006) X11 mouse reporting. */ #define A_X116MOUSE_IN 68 -#define A_X116MOUSE_IGNORE 69 +#define A_CLR_SEARCH 70 +/* These values must not conflict with any A_* or EC_* value. */ #define A_INVALID 100 #define A_NOACTION 101 #define A_UINVALID 102 #define A_END_LIST 103 #define A_SPECIAL_KEY 104 - +#define A_PREFIX 105 #define A_SKIP 127 #define A_EXTRA 0200 @@ -111,15 +110,16 @@ #define EC_B_COMPLETE 18 #define EC_LITERAL 19 #define EC_ABORT 20 +#define EC_X11MOUSE 21 +#define EC_X116MOUSE 22 -#define EC_NOACTION 101 #define EC_UINVALID 102 /* Flags for editchar() */ -#define EC_PEEK 01 -#define EC_NOHISTORY 02 -#define EC_NOCOMPLETE 04 -#define EC_NORIGHTLEFT 010 +#define ECF_PEEK 01 +#define ECF_NOHISTORY 02 +#define ECF_NOCOMPLETE 04 +#define ECF_NORIGHTLEFT 010 /* Environment variable stuff */ #define EV_OK 01 diff --git a/cmdbuf.c b/cmdbuf.c index ed78ded00307..9cc1f3e94977 100644 --- a/cmdbuf.c +++ b/cmdbuf.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2020 Mark Nudelman + * Copyright (C) 1984-2021 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. @@ -26,12 +26,12 @@ extern int no_hist_dups; extern int marks_modified; static char cmdbuf[CMDBUF_SIZE]; /* Buffer for holding a multi-char command */ -static int cmd_col; /* Current column of the cursor */ -static int prompt_col; /* Column of cursor just after prompt */ -static char *cp; /* Pointer into cmdbuf */ -static int cmd_offset; /* Index into cmdbuf of first displayed char */ -static int literal; /* Next input char should not be interpreted */ -static int updown_match = -1; /* Prefix length in up/down movement */ +static int cmd_col; /* Current column of the cursor */ +static int prompt_col; /* Column of cursor just after prompt */ +static char *cp; /* Pointer into cmdbuf */ +static int cmd_offset; /* Index into cmdbuf of first displayed char */ +static int literal; /* Next input char should not be interpreted */ +static int updown_match = -1; /* Prefix length in up/down movement */ #if TAB_COMPLETE_FILENAME static int cmd_complete LESSPARAMS((int action)); @@ -223,7 +223,7 @@ cmd_step_common(p, ch, len, pwidth, bswidth) } } if (pwidth != NULL) - *pwidth = width; + *pwidth = width; if (bswidth != NULL) *bswidth = width; return (pr); @@ -259,17 +259,42 @@ cmd_step_left(pp, pwidth, bswidth) return cmd_step_common(*pp, ch, p - *pp, pwidth, bswidth); } +/* + * Put the cursor at "home" (just after the prompt), + * and set cp to the corresponding char in cmdbuf. + */ + static void +cmd_home(VOID_PARAM) +{ + while (cmd_col > prompt_col) + { + int width, bswidth; + + cmd_step_left(&cp, &width, &bswidth); + while (bswidth-- > 0) + putbs(); + cmd_col -= width; + } + + cp = &cmdbuf[cmd_offset]; +} + /* * Repaint the line from cp onwards. * Then position the cursor just after the char old_cp (a pointer into cmdbuf). */ - static void + public void cmd_repaint(old_cp) constant char *old_cp; { /* * Repaint the line from the current position. */ + if (old_cp == NULL) + { + old_cp = cp; *** 12107 LINES SKIPPED ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104190116.13J1Gnb5058461>