Resolve conflicts to complete less v408 import.

Approved by:	re (kensmith)
This commit is contained in:
Xin LI 2007-10-08 16:17:42 +00:00
parent e62cd27f64
commit 59a2d0779b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=172471
5 changed files with 38 additions and 21 deletions

View File

@ -150,6 +150,8 @@ void free();
#define IS_DIGIT(c) ((c) >= '0' && (c) <= '9') #define IS_DIGIT(c) ((c) >= '0' && (c) <= '9')
#endif #endif
#define IS_CSI_START(c) ((c) == ESC || ((unsigned char)(c)) == CSI)
#ifndef NULL #ifndef NULL
#define NULL 0 #define NULL 0
#endif #endif
@ -425,6 +427,7 @@ struct textlist
#endif /* IS_EBCDIC_HOST */ #endif /* IS_EBCDIC_HOST */
#define ESC CONTROL('[') #define ESC CONTROL('[')
#define CSI ((unsigned char)'\233')
#if _OSK_MWC32 #if _OSK_MWC32
#define LSIGNAL(sig,func) os9_signal(sig,func) #define LSIGNAL(sig,func) os9_signal(sig,func)

View File

@ -269,7 +269,7 @@ pshift(shift)
while (shifted <= shift && from < curr) while (shifted <= shift && from < curr)
{ {
c = linebuf[from]; c = linebuf[from];
if (c == ESC && ctldisp == OPT_ONPLUS) if (ctldisp == OPT_ONPLUS && IS_CSI_START(c))
{ {
/* Keep cumulative effect. */ /* Keep cumulative effect. */
linebuf[to] = c; linebuf[to] = c;
@ -524,7 +524,7 @@ in_ansi_esc_seq()
for (p = &linebuf[curr]; p > linebuf; ) for (p = &linebuf[curr]; p > linebuf; )
{ {
LWCHAR ch = step_char(&p, -1, linebuf); LWCHAR ch = step_char(&p, -1, linebuf);
if (ch == ESC) if (IS_CSI_START(ch))
return (1); return (1);
if (!is_ansi_middle(ch)) if (!is_ansi_middle(ch))
return (0); return (0);
@ -603,13 +603,13 @@ store_char(ch, a, rep, pos)
/* Remove whole unrecognized sequence. */ /* Remove whole unrecognized sequence. */
do { do {
--curr; --curr;
} while (linebuf[curr] != ESC); } while (!IS_CSI_START(linebuf[curr]));
return 0; return 0;
} }
a = AT_ANSI; /* Will force re-AT_'ing around it. */ a = AT_ANSI; /* Will force re-AT_'ing around it. */
w = 0; w = 0;
} }
else if (ctldisp == OPT_ONPLUS && ch == ESC) else if (ctldisp == OPT_ONPLUS && IS_CSI_START(ch))
{ {
a = AT_ANSI; /* Will force re-AT_'ing around it. */ a = AT_ANSI; /* Will force re-AT_'ing around it. */
w = 0; w = 0;
@ -943,7 +943,7 @@ do_append(ch, rep, pos)
} else if ((!utf_mode || is_ascii_char(ch)) && control_char((char)ch)) } else if ((!utf_mode || is_ascii_char(ch)) && control_char((char)ch))
{ {
do_control_char: do_control_char:
if (ctldisp == OPT_ON || (ctldisp == OPT_ONPLUS && ch == ESC)) if (ctldisp == OPT_ON || (ctldisp == OPT_ONPLUS && IS_CSI_START(ch)))
{ {
/* /*
* Output as a normal character. * Output as a normal character.

View File

@ -16,6 +16,7 @@
#include "less.h" #include "less.h"
#include "position.h" #include "position.h"
#include "charset.h"
#define MINPOS(a,b) (((a) < (b)) ? (a) : (b)) #define MINPOS(a,b) (((a) < (b)) ? (a) : (b))
#define MAXPOS(a,b) (((a) > (b)) ? (a) : (b)) #define MAXPOS(a,b) (((a) > (b)) ? (a) : (b))
@ -120,24 +121,31 @@ cvt_text(odst, osrc, lenp, ops)
int *lenp; int *lenp;
int ops; int ops;
{ {
register char *dst; char *dst;
register char *src; char *src;
register char *src_end; register char *src_end;
LWCHAR ch;
if (lenp != NULL) if (lenp != NULL)
src_end = osrc + *lenp; src_end = osrc + *lenp;
else else
src_end = osrc + strlen(osrc); src_end = osrc + strlen(osrc);
for (src = osrc, dst = odst; src < src_end; src++) for (src = osrc, dst = odst; src < src_end; )
{ {
if ((ops & CVT_TO_LC) && IS_UPPER(*src)) ch = step_char(&src, +1, src_end);
if ((ops & CVT_TO_LC) && IS_UPPER(ch))
{
/* Convert uppercase to lowercase. */ /* Convert uppercase to lowercase. */
*dst++ = TO_LOWER(*src); put_wchar(&dst, TO_LOWER(ch));
else if ((ops & CVT_BS) && *src == '\b' && dst > odst) } else if ((ops & CVT_BS) && ch == '\b' && dst > odst)
{
/* Delete BS and preceding char. */ /* Delete BS and preceding char. */
dst--; do {
else if ((ops & CVT_ANSI) && *src == ESC) dst--;
} while (dst > odst &&
!IS_ASCII_OCTET(*dst) && !IS_UTF8_LEAD(*dst));
} else if ((ops & CVT_ANSI) && IS_CSI_START(ch))
{ {
/* Skip to end of ANSI escape sequence. */ /* Skip to end of ANSI escape sequence. */
while (src + 1 != src_end) while (src + 1 != src_end)
@ -145,7 +153,7 @@ cvt_text(odst, osrc, lenp, ops)
break; break;
} else } else
/* Just copy. */ /* Just copy. */
*dst++ = *src; put_wchar(&dst, ch);
} }
if ((ops & CVT_CRLF) && dst > odst && dst[-1] == '\r') if ((ops & CVT_CRLF) && dst > odst && dst[-1] == '\r')
dst--; dst--;
@ -182,14 +190,18 @@ get_cvt_ops()
* Are there any uppercase letters in this string? * Are there any uppercase letters in this string?
*/ */
static int static int
is_ucase(s) is_ucase(str)
char *s; char *str;
{ {
register char *p; char *str_end = str + strlen(str);
LWCHAR ch;
for (p = s; *p != '\0'; p++) while (str < str_end)
if (IS_UPPER(*p)) {
ch = step_char(&str, +1, str_end);
if (IS_UPPER(ch))
return (1); return (1);
}
return (0); return (0);
} }
@ -679,7 +691,7 @@ adj_hilite_ansi(cvt_ops, line, line_len, npos)
char *line_end = *line + line_len; char *line_end = *line + line_len;
if (cvt_ops & CVT_ANSI) if (cvt_ops & CVT_ANSI)
while (**line == ESC) while (IS_CSI_START(**line))
{ {
/* /*
* Found an ESC. The file position moves * Found an ESC. The file position moves

View File

@ -93,6 +93,8 @@ winch(type)
{ {
LSIGNAL(SIGWINCH, winch); LSIGNAL(SIGWINCH, winch);
sigs |= S_WINCH; sigs |= S_WINCH;
if (reading)
intread();
} }
#else #else
#ifdef SIGWIND #ifdef SIGWIND

View File

@ -2314,7 +2314,7 @@ mdconfig_md1="-t vnode -f /var/foo.img"</programlisting>
4.1.8 to 4.1.23.</para> 4.1.8 to 4.1.23.</para>
<para><application>less</application> has been updated from v381 <para><application>less</application> has been updated from v381
to v406. &merged;</para> to v408.</para>
<para><application>libpcap</application> has been updated from <para><application>libpcap</application> has been updated from
0.9.1 to 0.9.4. &merged;</para> 0.9.1 to 0.9.4. &merged;</para>