1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-28 05:29:48 +00:00
freebsd-ports/sysutils/less/files/patch-ab
Sunpoet Po-Chuan Hsieh 63a477b9ea - Update to 436
Changes:
- http://www.greenwoodsoftware.com/less/news.436.html
- http://www.greenwoodsoftware.com/less/old.html

PR:		ports/151825
Submitted by:	Jason Harris <jharris@widomaker.com> (maintainer)
Approved by:	pgollucci (mentor, implicit)
2010-10-30 06:54:29 +00:00

43 lines
834 B
Plaintext

--- charset.c.orig 2010/10/30 02:38:17
+++ charset.c 2010/10/30 02:40:03
@@ -408,6 +408,10 @@
control_char(c)
LWCHAR c;
{
+#ifdef COLOR_LESS
+ if (c == ESC)
+ return 0;
+#endif
c &= 0377;
return (chardef[c] & IS_CONTROL_CHAR);
}
@@ -423,6 +427,20 @@
/* {{ This buffer can be overrun if LESSBINFMT is a long string. }} */
static char buf[32];
+#ifdef COLOR_LESS
+ if(c == ESC)
+ sprintf(buf, "%c", ESC);
+ else
+ {
+ c &= 0377;
+ if (!control_char(c))
+ sprintf(buf, "%c", c);
+ else if (!control_char(c ^ 0100))
+ sprintf(buf, "^%c", c ^ 0100);
+ else
+ sprintf(buf, binfmt, c);
+ }
+#else
c &= 0377;
if ((c < 128 || !utf_mode) && !control_char(c))
SNPRINTF1(buf, sizeof(buf), "%c", (int) c);
@@ -446,6 +464,7 @@
#endif
else
SNPRINTF1(buf, sizeof(buf), binfmt, c);
+#endif
return (buf);
}