Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Mar 2018 06:39:01 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r330571 - in stable/10: contrib/less usr.bin/less
Message-ID:  <201803070639.w276d14P008060@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Wed Mar  7 06:39:00 2018
New Revision: 330571
URL: https://svnweb.freebsd.org/changeset/base/330571

Log:
  MFC r316339,317396,317829,326010,329554: less v530.
  
  Relnotes:	yes

Added:
  stable/10/contrib/less/fmt.uni
     - copied unchanged from r326010, head/contrib/less/fmt.uni
Deleted:
  stable/10/contrib/less/mkhelp.c
Modified:
  stable/10/contrib/less/LICENSE
  stable/10/contrib/less/NEWS
  stable/10/contrib/less/README
  stable/10/contrib/less/brac.c
  stable/10/contrib/less/ch.c
  stable/10/contrib/less/charset.c
  stable/10/contrib/less/charset.h
  stable/10/contrib/less/cmd.h
  stable/10/contrib/less/cmdbuf.c
  stable/10/contrib/less/command.c
  stable/10/contrib/less/compose.uni
  stable/10/contrib/less/cvt.c
  stable/10/contrib/less/decode.c
  stable/10/contrib/less/edit.c
  stable/10/contrib/less/filename.c
  stable/10/contrib/less/forwback.c
  stable/10/contrib/less/funcs.h
  stable/10/contrib/less/help.c
  stable/10/contrib/less/ifile.c
  stable/10/contrib/less/input.c
  stable/10/contrib/less/jump.c
  stable/10/contrib/less/less.h
  stable/10/contrib/less/less.hlp
  stable/10/contrib/less/less.nro
  stable/10/contrib/less/lessecho.c
  stable/10/contrib/less/lessecho.nro
  stable/10/contrib/less/lesskey.c
  stable/10/contrib/less/lesskey.h
  stable/10/contrib/less/lesskey.nro
  stable/10/contrib/less/lglob.h
  stable/10/contrib/less/line.c
  stable/10/contrib/less/linenum.c
  stable/10/contrib/less/lsystem.c
  stable/10/contrib/less/main.c
  stable/10/contrib/less/mark.c
  stable/10/contrib/less/mkutable
  stable/10/contrib/less/optfunc.c
  stable/10/contrib/less/option.c
  stable/10/contrib/less/option.h
  stable/10/contrib/less/opttbl.c
  stable/10/contrib/less/os.c
  stable/10/contrib/less/output.c
  stable/10/contrib/less/pattern.c
  stable/10/contrib/less/pattern.h
  stable/10/contrib/less/pckeys.h
  stable/10/contrib/less/position.c
  stable/10/contrib/less/position.h
  stable/10/contrib/less/prompt.c
  stable/10/contrib/less/screen.c
  stable/10/contrib/less/scrsize.c
  stable/10/contrib/less/search.c
  stable/10/contrib/less/signal.c
  stable/10/contrib/less/tags.c
  stable/10/contrib/less/ttyin.c
  stable/10/contrib/less/ubin.uni
  stable/10/contrib/less/version.c
  stable/10/contrib/less/wide.uni
  stable/10/usr.bin/less/defines.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/less/LICENSE
==============================================================================
--- stable/10/contrib/less/LICENSE	Wed Mar  7 06:13:47 2018	(r330570)
+++ stable/10/contrib/less/LICENSE	Wed Mar  7 06:39:00 2018	(r330571)
@@ -2,7 +2,7 @@
                           ------------
 
 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

Modified: stable/10/contrib/less/NEWS
==============================================================================
--- stable/10/contrib/less/NEWS	Wed Mar  7 06:13:47 2018	(r330570)
+++ stable/10/contrib/less/NEWS	Wed Mar  7 06:39:00 2018	(r330571)
@@ -11,6 +11,82 @@
 
 ======================================================================
 
+	Major changes between "less" versions 487 and 530
+
+* Don't output terminal init sequence if using -F and file fits on one screen.
+
+* When using -S, mark truncated lines with a special character.
+  The character can be changed or disabled via the new --rscroll option.
+
+* New command M marks the last line displayed on the screen.
+
+* New command ESC-m removes a line mark.
+
+* Status column (enabled via -J) now shows mark letters.
+
+* Status column shows search matches even if highlighting is disabled via -G.
+
+* A second ESC-u command will clear search match markers in the status column.
+
+* Do same ANSI escape code filtering for tag matching that we do for 
+  searching, to help when viewing syntax-highlighted code.
+  
+* Catch SIGTERM and clean up before exiting.
+
+* Fix bug initializing default charset on Windows.
+
+* Handle keypad ENTER key correctly if it sends something other than newline.
+
+* Fix buffering bug when using stdin with a LESSOPEN pipe.
+
+* On Windows, allow 'u' in -D option to enable underlining.
+
+* On Windows, use underline in sgr mode.
+
+* On Windows, convert UTF-8 to multibyte if console is not UTF-8.
+
+* Update Unicode tables to 2017-03-08.
+
+* Pass-thru Unicode formating chars (Cf type) instead of treating them
+  as binary chars. But treat them as binary if -U is set.
+
+* Fix erroneous binary file warning when UTF-8 file contains ANSI SGR sequences.
+
+* Fix bugs when using LESSOPEN and switching between stdin and other files.
+
+* Fix some bugs handling filenames containing shell metacharacters.
+
+* Fix some memory leaks.
+
+* Allow some debugging environment variables to be set in lesskey file.
+
+* Code improvements:
+  . Use ANSI prototypes in funcs.h declarations.
+  . Fix some const mismatches.
+  . Remove archaic "register" in variable declarations.
+
+======================================================================
+
+	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.

Modified: stable/10/contrib/less/README
==============================================================================
--- stable/10/contrib/less/README	Wed Mar  7 06:13:47 2018	(r330570)
+++ stable/10/contrib/less/README	Wed Mar  7 06:39:00 2018	(r330571)
@@ -7,9 +7,9 @@
 **************************************************************************
 **************************************************************************
 
-                            Less, version 481
+                            Less, version 530
 
-    This is the distribution of less, version 481, released 31 Aug 2015.
+    This is the distribution of less, version 530, released 05 Dec 2017.
     This program is part of the GNU project (http://www.gnu.org).
 
     This program is free software.  You may redistribute it and/or
@@ -23,6 +23,7 @@
 
     Please report any problems to bug-less@gnu.org.
     See http://www.greenwoodsoftware.com/less for the latest info.
+    Source repository is at https://github.com/gwsw/less.git.
 
 =========================================================================
 

Modified: stable/10/contrib/less/brac.c
==============================================================================
--- stable/10/contrib/less/brac.c	Wed Mar  7 06:13:47 2018	(r330570)
+++ stable/10/contrib/less/brac.c	Wed Mar  7 06:39:00 2018	(r330571)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2015  Mark Nudelman
+ * Copyright (C) 1984-2017  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.
@@ -25,13 +25,13 @@
  */
 	public void
 match_brac(obrac, cbrac, forwdir, n)
-	register int obrac;
-	register int cbrac;
+	int obrac;
+	int cbrac;
 	int forwdir;
 	int n;
 {
-	register int c;
-	register int nest;
+	int c;
+	int nest;
 	POSITION pos;
 	int (*chget)();
 

Modified: stable/10/contrib/less/ch.c
==============================================================================
--- stable/10/contrib/less/ch.c	Wed Mar  7 06:13:47 2018	(r330570)
+++ stable/10/contrib/less/ch.c	Wed Mar  7 06:39:00 2018	(r330571)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2015  Mark Nudelman
+ * Copyright (C) 1984-2017  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.
@@ -146,11 +146,11 @@ static int ch_addbuf();
 	int
 ch_get()
 {
-	register struct buf *bp;
-	register struct bufnode *bn;
-	register int n;
-	register int slept;
-	register int h;
+	struct buf *bp;
+	struct bufnode *bn;
+	int n;
+	int slept;
+	int h;
 	POSITION pos;
 	POSITION len;
 
@@ -419,8 +419,8 @@ end_logfile()
 	public void
 sync_logfile()
 {
-	register struct buf *bp;
-	register struct bufnode *bn;
+	struct buf *bp;
+	struct bufnode *bn;
 	int warned = FALSE;
 	BLOCKNUM block;
 	BLOCKNUM nblocks;
@@ -457,9 +457,9 @@ sync_logfile()
 buffered(block)
 	BLOCKNUM block;
 {
-	register struct buf *bp;
-	register struct bufnode *bn;
-	register int h;
+	struct buf *bp;
+	struct bufnode *bn;
+	int h;
 
 	h = BUFHASH(block);
 	FOR_BUFS_IN_CHAIN(h, bn)
@@ -477,7 +477,7 @@ buffered(block)
  */
 	public int
 ch_seek(pos)
-	register POSITION pos;
+	POSITION pos;
 {
 	BLOCKNUM new_block;
 	POSITION len;
@@ -544,8 +544,8 @@ ch_end_seek()
 	public int
 ch_end_buffer_seek()
 {
-	register struct buf *bp;
-	register struct bufnode *bn;
+	struct buf *bp;
+	struct bufnode *bn;
 	POSITION buf_pos;
 	POSITION end_pos;
 
@@ -572,8 +572,8 @@ ch_end_buffer_seek()
 	public int
 ch_beg_seek()
 {
-	register struct bufnode *bn;
-	register struct bufnode *firstbn;
+	struct bufnode *bn;
+	struct bufnode *firstbn;
 
 	/*
 	 * Try a plain ch_seek first.
@@ -632,7 +632,7 @@ ch_tell()
 	public int
 ch_forw_get()
 {
-	register int c;
+	int c;
 
 	if (thisfile == NULL)
 		return (EOI);
@@ -695,7 +695,7 @@ ch_setbufspace(bufspace)
 	public void
 ch_flush()
 {
-	register struct bufnode *bn;
+	struct bufnode *bn;
 
 	if (thisfile == NULL)
 		return;
@@ -762,8 +762,8 @@ ch_flush()
 	static int
 ch_addbuf()
 {
-	register struct buf *bp;
-	register struct bufnode *bn;
+	struct buf *bp;
+	struct bufnode *bn;
 
 	/*
 	 * Allocate and initialize a new buffer and link it 
@@ -787,7 +787,7 @@ ch_addbuf()
 	static void
 init_hashtbl()
 {
-	register int h;
+	int h;
 
 	for (h = 0;  h < BUFHASH_SIZE;  h++)
 	{
@@ -802,7 +802,7 @@ init_hashtbl()
 	static void
 ch_delbufs()
 {
-	register struct bufnode *bn;
+	struct bufnode *bn;
 
 	while (ch_bufhead != END_OF_CHAIN)
 	{
@@ -867,13 +867,12 @@ ch_init(f, flags)
 				calloc(1, sizeof(struct filestate));
 		thisfile->buflist.next = thisfile->buflist.prev = END_OF_CHAIN;
 		thisfile->nbufs = 0;
-		thisfile->flags = 0;
+		thisfile->flags = flags;
 		thisfile->fpos = 0;
 		thisfile->block = 0;
 		thisfile->offset = 0;
 		thisfile->file = -1;
 		thisfile->fsize = NULL_POSITION;
-		ch_flags = flags;
 		init_hashtbl();
 		/*
 		 * Try to seek; set CH_CANSEEK if it works.
@@ -898,7 +897,7 @@ ch_close()
 	if (thisfile == NULL)
 		return;
 
-	if (ch_flags & (CH_CANSEEK|CH_POPENED|CH_HELPFILE))
+	if ((ch_flags & (CH_CANSEEK|CH_POPENED|CH_HELPFILE)) && !(ch_flags & CH_KEEPOPEN))
 	{
 		/*
 		 * We can seek or re-open, so we don't need to keep buffers.

Modified: stable/10/contrib/less/charset.c
==============================================================================
--- stable/10/contrib/less/charset.c	Wed Mar  7 06:13:47 2018	(r330570)
+++ stable/10/contrib/less/charset.c	Wed Mar  7 06:39:00 2018	(r330571)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2015  Mark Nudelman
+ * Copyright (C) 1984-2017  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.
@@ -22,6 +22,13 @@
 
 #include "charset.h"
 
+#if MSDOS_COMPILER==WIN32C
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#endif
+
+extern int bs_mode;
+
 public int utf_mode = 0;
 
 /*
@@ -64,6 +71,8 @@ struct cs_alias {
 	char *oname;
 } cs_aliases[] = {
 	{ "UTF-8",		"utf-8" },
+	{ "utf8",		"utf-8" },
+	{ "UTF8",		"utf-8" },
 	{ "ANSI_X3.4-1968",	"ascii" },
 	{ "US-ASCII",		"ascii" },
 	{ "latin1",		"iso8859" },
@@ -133,9 +142,9 @@ public int binattr = AT_STANDOUT;
 ichardef(s)
 	char *s;
 {
-	register char *cp;
-	register int n;
-	register char v;
+	char *cp;
+	int n;
+	char v;
 
 	n = 0;
 	v = 0;
@@ -188,11 +197,11 @@ ichardef(s)
  */
 	static int
 icharset(name, no_error)
-	register char *name;
+	char *name;
 	int no_error;
 {
-	register struct charset *p;
-	register struct cs_alias *a;
+	struct charset *p;
+	struct cs_alias *a;
 
 	if (name == NULL || *name == '\0')
 		return (0);
@@ -213,7 +222,13 @@ icharset(name, no_error)
 		{
 			ichardef(p->desc);
 			if (p->p_flag != NULL)
+			{
+#if MSDOS_COMPILER==WIN32C
+				*(p->p_flag) = 1 + (GetConsoleOutputCP() != CP_UTF8);
+#else
 				*(p->p_flag) = 1;
+#endif
+			}
 			return (1);
 		}
 	}
@@ -232,7 +247,7 @@ icharset(name, no_error)
 	static void
 ilocale()
 {
-	register int c;
+	int c;
 
 	for (c = 0;  c < (int) sizeof(chardef);  c++)
 	{
@@ -249,16 +264,17 @@ ilocale()
 /*
  * Define the printing format for control (or binary utf) chars.
  */
-   	static void
-setbinfmt(s, fmtvarptr, default_fmt)
+	public void
+setfmt(s, fmtvarptr, attrptr, default_fmt)
 	char *s;
 	char **fmtvarptr;
+	int *attrptr;
 	char *default_fmt;
 {
 	if (s && utf_mode)
 	{
 		/* It would be too hard to account for width otherwise.  */
-		char *t = s;
+		char constant *t = s;
 		while (*t)
 		{
 			if (*t < ' ' || *t > '~')
@@ -280,15 +296,15 @@ setbinfmt(s, fmtvarptr, default_fmt)
 	 * Select the attributes if it starts with "*".
 	 */
  attr:
-	if (*s == '*')
+	if (*s == '*' && s[1] != '\0')
 	{
 		switch (s[1])
 		{
-		case 'd':  binattr = AT_BOLD;      break;
-		case 'k':  binattr = AT_BLINK;     break;
-		case 's':  binattr = AT_STANDOUT;  break;
-		case 'u':  binattr = AT_UNDERLINE; break;
-		default:   binattr = AT_NORMAL;    break;
+		case 'd':  *attrptr = AT_BOLD;      break;
+		case 'k':  *attrptr = AT_BLINK;     break;
+		case 's':  *attrptr = AT_STANDOUT;  break;
+		case 'u':  *attrptr = AT_UNDERLINE; break;
+		default:   *attrptr = AT_NORMAL;    break;
 		}
 		s += 2;
 	}
@@ -303,7 +319,15 @@ set_charset()
 {
 	char *s;
 
+#if MSDOS_COMPILER==WIN32C
 	/*
+	 * If the Windows console is using UTF-8, we'll use it too.
+	 */
+	if (GetConsoleOutputCP() == CP_UTF8)
+		if (icharset("utf-8", 1))
+			return;
+#endif
+	/*
 	 * See if environment variable LESSCHARSET is defined.
 	 */
 	s = lgetenv("LESSCHARSET");
@@ -352,6 +376,7 @@ set_charset()
 	 * rather than from predefined charset entry.
 	 */
 	ilocale();
+#else
 #if MSDOS_COMPILER
 	/*
 	 * Default to "dos".
@@ -381,10 +406,10 @@ init_charset()
 	set_charset();
 
 	s = lgetenv("LESSBINFMT");
-	setbinfmt(s, &binfmt, "*s<%02X>");
+	setfmt(s, &binfmt, &binattr, "*s<%02X>");
 	
 	s = lgetenv("LESSUTFBINFMT");
-	setbinfmt(s, &utfbinfmt, "<U+%04lX>");
+	setfmt(s, &utfbinfmt, &binattr, "<U+%04lX>");
 }
 
 /*
@@ -484,7 +509,7 @@ prutfchar(ch)
  */
 	public int
 utf_len(ch)
-	char ch;
+	unsigned char ch;
 {
 	if ((ch & 0x80) == 0)
 		return 1;
@@ -506,17 +531,18 @@ utf_len(ch)
  * Does the parameter point to the lead byte of a well-formed UTF-8 character?
  */
 	public int
-is_utf8_well_formed(s, slen)
-	unsigned char *s;
+is_utf8_well_formed(ss, slen)
+	char *ss;
 	int slen;
 {
 	int i;
 	int len;
+	unsigned char *s = (unsigned char *) ss;
 
 	if (IS_UTF8_INVALID(s[0]))
 		return (0);
 
-	len = utf_len((char) s[0]);
+	len = utf_len(s[0]);
 	if (len > slen)
 		return (0);
 	if (len == 1)
@@ -540,40 +566,25 @@ is_utf8_well_formed(s, slen)
 }
 
 /*
- * Return number of invalid UTF-8 sequences found in a buffer.
+ * Skip bytes until a UTF-8 lead byte (11xxxxxx) or ASCII byte (0xxxxxxx) is found.
  */
-	public int
-utf_bin_count(data, len)
-	unsigned char *data;
-	int len;
+	public void
+utf_skip_to_lead(pp, limit)
+	char **pp;
+	char *limit;
 {
-	int bin_count = 0;
-	while (len > 0)
-	{
-		if (is_utf8_well_formed(data, len))
-		{
-			int clen = utf_len(*data);
-			data += clen;
-			len -= clen;
-		} else
-		{
-			/* Skip to next lead byte. */
-			bin_count++;
-			do {
-				++data;
-				--len;
-			} while (len > 0 && !IS_UTF8_LEAD(*data));
-		}
-	}
-	return (bin_count);
+	do {
+		++(*pp);
+	} while (*pp < limit && !IS_UTF8_LEAD((*pp)[0] & 0377) && !IS_ASCII_OCTET((*pp)[0]));
 }
 
+
 /*
  * Get the value of a UTF-8 character.
  */
 	public LWCHAR
 get_wchar(p)
-	char *p;
+	constant char *p;
 {
 	switch (utf_len(p[0]))
 	{
@@ -677,7 +688,7 @@ put_wchar(pp, ch)
 step_char(pp, dir, limit)
 	char **pp;
 	signed int dir;
-	char *limit;
+	constant char *limit;
 {
 	LWCHAR ch;
 	int len;
@@ -687,16 +698,16 @@ step_char(pp, dir, limit)
 	{
 		/* It's easy if chars are one byte. */
 		if (dir > 0)
-			ch = (LWCHAR) ((p < limit) ? *p++ : 0);
+			ch = (LWCHAR) (unsigned char) ((p < limit) ? *p++ : 0);
 		else
-			ch = (LWCHAR) ((p > limit) ? *--p : 0);
+			ch = (LWCHAR) (unsigned char) ((p > limit) ? *--p : 0);
 	} else if (dir > 0)
 	{
 		len = utf_len(*p);
 		if (p + len > limit)
 		{
 			ch = 0;
-			p = limit;
+			p = (char *) limit;
 		} else
 		{
 			ch = get_wchar(p);
@@ -737,6 +748,10 @@ DECLARE_RANGE_TABLE_START(wide)
 #include "wide.uni"
 DECLARE_RANGE_TABLE_END(wide)
 
+DECLARE_RANGE_TABLE_START(fmt)
+#include "fmt.uni"
+DECLARE_RANGE_TABLE_END(fmt)
+
 /* comb_table is special pairs, not ranges. */
 static struct wchar_range comb_table[] = {
 	{0x0644,0x0622}, {0x0644,0x0623}, {0x0644,0x0625}, {0x0644,0x0627},
@@ -777,7 +792,8 @@ is_in_table(ch, table)
 is_composing_char(ch)
 	LWCHAR ch;
 {
-	return is_in_table(ch, &compose_table);
+	return is_in_table(ch, &compose_table) ||
+	       (bs_mode != BS_CONTROL && is_in_table(ch, &fmt_table));
 }
 
 /*
@@ -787,7 +803,21 @@ is_composing_char(ch)
 is_ubin_char(ch)
 	LWCHAR ch;
 {
-	return is_in_table(ch, &ubin_table);
+	int ubin = is_in_table(ch, &ubin_table) ||
+	           (bs_mode == BS_CONTROL && is_in_table(ch, &fmt_table));
+#if MSDOS_COMPILER==WIN32C
+	if (!ubin && utf_mode == 2 && ch < 0x10000)
+	{
+		/*
+		 * Consider it binary if it can't be converted.
+		 */
+		BOOL used_default = TRUE;
+		WideCharToMultiByte(GetConsoleOutputCP(), WC_NO_BEST_FIT_CHARS, (LPCWSTR) &ch, 1, NULL, 0, NULL, &used_default);
+		if (used_default)
+			ubin = 1;
+	}
+#endif
+	return ubin;
 }
 
 /*

Modified: stable/10/contrib/less/charset.h
==============================================================================
--- stable/10/contrib/less/charset.h	Wed Mar  7 06:13:47 2018	(r330570)
+++ stable/10/contrib/less/charset.h	Wed Mar  7 06:39:00 2018	(r330571)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2015  Mark Nudelman
+ * Copyright (C) 1984-2017  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.

Modified: stable/10/contrib/less/cmd.h
==============================================================================
--- stable/10/contrib/less/cmd.h	Wed Mar  7 06:13:47 2018	(r330570)
+++ stable/10/contrib/less/cmd.h	Wed Mar  7 06:39:00 2018	(r330571)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2015  Mark Nudelman
+ * Copyright (C) 1984-2017  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.
@@ -8,127 +8,131 @@
  */
 
 
-#define	MAX_USERCMD		1000
-#define	MAX_CMDLEN		16
+#define MAX_USERCMD            1000
+#define MAX_CMDLEN             16
 
-#define	A_B_LINE		2
-#define	A_B_SCREEN		3
-#define	A_B_SCROLL		4
-#define	A_B_SEARCH		5
-#define	A_DIGIT			6
-#define	A_DISP_OPTION		7
-#define	A_DEBUG			8
-#define	A_EXAMINE		9
-#define	A_FIRSTCMD		10
-#define	A_FREPAINT		11
-#define	A_F_LINE		12
-#define	A_F_SCREEN		13
-#define	A_F_SCROLL		14
-#define	A_F_SEARCH		15
-#define	A_GOEND			16
-#define	A_GOLINE		17
-#define	A_GOMARK		18
-#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
-#define	A_SETMARK		26
-#define	A_SHELL			27
-#define	A_STAT			28
-#define	A_FF_LINE		29
-#define	A_BF_LINE		30
-#define	A_VERSION		31
-#define	A_VISUAL		32
-#define	A_F_WINDOW		33
-#define	A_B_WINDOW		34
-#define	A_F_BRACKET		35
-#define	A_B_BRACKET		36
-#define	A_PIPE			37
-#define	A_INDEX_FILE		38
-#define	A_UNDO_SEARCH		39
-#define	A_FF_SCREEN		40
-#define	A_LSHIFT		41
-#define	A_RSHIFT		42
-#define	A_AGAIN_SEARCH		43
-#define	A_T_AGAIN_SEARCH	44
-#define	A_REVERSE_SEARCH	45
-#define	A_T_REVERSE_SEARCH	46
-#define	A_OPT_TOGGLE		47
-#define	A_OPT_SET		48
-#define	A_OPT_UNSET		49
-#define	A_F_FOREVER		50
-#define	A_GOPOS			51
-#define	A_REMOVE_FILE		52
-#define	A_NEXT_TAG		53
-#define	A_PREV_TAG		54
-#define	A_FILTER		55
-#define	A_F_UNTIL_HILITE	56
-#define	A_GOEND_BUF		57
+#define A_B_LINE               2
+#define A_B_SCREEN             3
+#define A_B_SCROLL             4
+#define A_B_SEARCH             5
+#define A_DIGIT                6
+#define A_DISP_OPTION          7
+#define A_DEBUG                8
+#define A_EXAMINE              9
+#define A_FIRSTCMD             10
+#define A_FREPAINT             11
+#define A_F_LINE               12
+#define A_F_SCREEN             13
+#define A_F_SCROLL             14
+#define A_F_SEARCH             15
+#define A_GOEND                16
+#define A_GOLINE               17
+#define A_GOMARK               18
+#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
+#define A_SETMARK              26
+#define A_SHELL                27
+#define A_STAT                 28
+#define A_FF_LINE              29
+#define A_BF_LINE              30
+#define A_VERSION              31
+#define A_VISUAL               32
+#define A_F_WINDOW             33
+#define A_B_WINDOW             34
+#define A_F_BRACKET            35
+#define A_B_BRACKET            36
+#define A_PIPE                 37
+#define A_INDEX_FILE           38
+#define A_UNDO_SEARCH          39
+#define A_FF_SCREEN            40
+#define A_LSHIFT               41
+#define A_RSHIFT               42
+#define A_AGAIN_SEARCH         43
+#define A_T_AGAIN_SEARCH       44
+#define A_REVERSE_SEARCH       45
+#define A_T_REVERSE_SEARCH     46
+#define A_OPT_TOGGLE           47
+#define A_OPT_SET              48
+#define A_OPT_UNSET            49
+#define A_F_FOREVER            50
+#define A_GOPOS                51
+#define A_REMOVE_FILE          52
+#define A_NEXT_TAG             53
+#define A_PREV_TAG             54
+#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_CLRMARK              62
+#define A_SETMARKBOT           63
 
-#define	A_INVALID		100
-#define	A_NOACTION		101
-#define	A_UINVALID		102
-#define	A_END_LIST		103
-#define	A_SPECIAL_KEY		104
+#define A_INVALID              100
+#define A_NOACTION             101
+#define A_UINVALID             102
+#define A_END_LIST             103
+#define A_SPECIAL_KEY          104
 
-#define A_SKIP			127
+#define A_SKIP                 127
 
-#define	A_EXTRA			0200
+#define A_EXTRA                0200
 
 
 /* Line editing characters */
 
-#define	EC_BACKSPACE	1
-#define	EC_LINEKILL	2
-#define	EC_RIGHT	3
-#define	EC_LEFT		4
-#define	EC_W_LEFT	5
-#define	EC_W_RIGHT	6
-#define	EC_INSERT 	7
-#define	EC_DELETE	8
-#define	EC_HOME		9
-#define	EC_END		10
-#define	EC_W_BACKSPACE	11
-#define	EC_W_DELETE	12
-#define	EC_UP		13
-#define	EC_DOWN		14
-#define	EC_EXPAND	15
-#define	EC_F_COMPLETE	17
-#define	EC_B_COMPLETE	18
-#define	EC_LITERAL	19
-#define	EC_ABORT	20
+#define EC_BACKSPACE           1
+#define EC_LINEKILL            2
+#define EC_RIGHT               3
+#define EC_LEFT                4
+#define EC_W_LEFT              5
+#define EC_W_RIGHT             6
+#define EC_INSERT              7
+#define EC_DELETE              8
+#define EC_HOME                9
+#define EC_END                 10
+#define EC_W_BACKSPACE         11
+#define EC_W_DELETE            12
+#define EC_UP                  13
+#define EC_DOWN                14
+#define EC_EXPAND              15
+#define EC_F_COMPLETE          17
+#define EC_B_COMPLETE          18
+#define EC_LITERAL             19
+#define EC_ABORT               20
 
-#define	EC_NOACTION	101
-#define	EC_UINVALID	102
+#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 EC_PEEK                01
+#define EC_NOHISTORY           02
+#define EC_NOCOMPLETE          04
+#define EC_NORIGHTLEFT         010
 
 /* Environment variable stuff */
-#define	EV_OK		01
+#define EV_OK                  01
 
 /* Special keys (keys which output different strings on different terminals) */
-#define SK_SPECIAL_KEY		CONTROL('K')
-#define SK_RIGHT_ARROW		1
-#define SK_LEFT_ARROW		2
-#define SK_UP_ARROW		3
-#define SK_DOWN_ARROW		4
-#define SK_PAGE_UP		5
-#define SK_PAGE_DOWN		6
-#define SK_HOME			7
-#define SK_END			8
-#define SK_DELETE		9
-#define SK_INSERT		10
-#define SK_CTL_LEFT_ARROW	11
-#define SK_CTL_RIGHT_ARROW	12
-#define SK_CTL_DELETE		13
-#define SK_F1			14
-#define SK_BACKTAB		15
-#define SK_CTL_BACKSPACE	16
-#define SK_CONTROL_K		40
+#define SK_SPECIAL_KEY         CONTROL('K')
+#define SK_RIGHT_ARROW         1
+#define SK_LEFT_ARROW          2
+#define SK_UP_ARROW            3
+#define SK_DOWN_ARROW          4
+#define SK_PAGE_UP             5
+#define SK_PAGE_DOWN           6
+#define SK_HOME                7
+#define SK_END                 8
+#define SK_DELETE              9
+#define SK_INSERT              10
+#define SK_CTL_LEFT_ARROW      11
+#define SK_CTL_RIGHT_ARROW     12
+#define SK_CTL_DELETE          13
+#define SK_F1                  14
+#define SK_BACKTAB             15
+#define SK_CTL_BACKSPACE       16
+#define SK_CONTROL_K           40

Modified: stable/10/contrib/less/cmdbuf.c
==============================================================================
--- stable/10/contrib/less/cmdbuf.c	Wed Mar  7 06:13:47 2018	(r330570)
+++ stable/10/contrib/less/cmdbuf.c	Wed Mar  7 06:39:00 2018	(r330571)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2015  Mark Nudelman
+ * Copyright (C) 1984-2017  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,7 +40,7 @@ static int in_completion = 0;
 static char *tk_text;
 static char *tk_original;
 static char *tk_ipoint;
-static char *tk_trial;
+static char *tk_trial = NULL;
 static struct textlist tk_tlist;
 #endif
 
@@ -76,25 +76,25 @@ struct mlist
  */
 struct mlist mlist_search =  
 	{ &mlist_search,  &mlist_search,  &mlist_search,  NULL, 0 };
-public void * constant ml_search = (void *) &mlist_search;
+public void *ml_search = (void *) &mlist_search;
 
 struct mlist mlist_examine = 
 	{ &mlist_examine, &mlist_examine, &mlist_examine, NULL, 0 };
-public void * constant ml_examine = (void *) &mlist_examine;
+public void *ml_examine = (void *) &mlist_examine;
 
 #if SHELL_ESCAPE || PIPEC
 struct mlist mlist_shell =   
 	{ &mlist_shell,   &mlist_shell,   &mlist_shell,   NULL, 0 };
-public void * constant ml_shell = (void *) &mlist_shell;
+public void *ml_shell = (void *) &mlist_shell;
 #endif
 
 #else /* CMD_HISTORY */
 
 /* If CMD_HISTORY is off, these are just flags. */
-public void * constant ml_search = (void *)1;
-public void * constant ml_examine = (void *)2;
+public void *ml_search = (void *)1;
+public void *ml_examine = (void *)2;
 #if SHELL_ESCAPE || PIPEC
-public void * constant ml_shell = (void *)3;
+public void *ml_shell = (void *)3;
 #endif
 
 #endif /* CMD_HISTORY */
@@ -141,28 +141,26 @@ clear_cmd()
  */
 	public void
 cmd_putstr(s)
-	char *s;
+	constant char *s;
 {
 	LWCHAR prev_ch = 0;
 	LWCHAR ch;
-	char *endline = s + strlen(s);
+	constant char *endline = s + strlen(s);
 	while (*s != '\0')
 	{
-		char *ns = s;
+		char *ns = (char *) 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;
 	}
 }
@@ -187,6 +185,8 @@ len_cmdbuf()
 
 /*
  * 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)
@@ -197,58 +197,32 @@ 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

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803070639.w276d14P008060>