From owner-man-jp@jp.freebsd.org  Sun Jul 29 11:04:39 2001
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id LAA79633;
	Sun, 29 Jul 2001 11:04:39 +0900 (JST)
	(envelope-from owner-man-jp@jp.FreeBSD.org)
Received: from mi01.iij4u.or.jp (mi01.iij4u.or.jp [210.130.0.81])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id LAA79628
	for <man-jp@jp.freebsd.org>; Sun, 29 Jul 2001 11:04:39 +0900 (JST)
	(envelope-from moriko@hh.iij4u.or.jp)
Received: from ruriruri.noe.mcu.or.jp (h086.p233.iij4u.or.jp [210.130.233.86])
	by mi01.iij4u.or.jp (8.8.8/MI1.3) with ESMTP id LAA19768
	for <man-jp@jp.freebsd.org>; Sun, 29 Jul 2001 11:04:38 +0900 (JST)
Received: from localhost (dhcp-251.noe.mcu.or.jp [172.16.2.251] (may be forged))
	by ruriruri.noe.mcu.or.jp (8.11.3/8.11.3) with ESMTP id f6T24b772693;
	Sun, 29 Jul 2001 11:04:37 +0900 (JST)
	(envelope-from moriko@hh.iij4u.or.jp)
Date: Sun, 29 Jul 2001 10:51:05 +0900 (JST)
Message-Id: <20010729.105105.94798648.moriko@hoge.noe.mcu.or.jp>
To: man-jp@jp.freebsd.org
From: MORI Kouji <moriko@hh.iij4u.or.jp>
References: <80r8v24xpx.fsf@kurishna.tri.asanuma.co.jp>
X-Mailer: Mew version 1.95b126 on Emacs 21.0 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Multipart/Mixed;
 boundary="--Next_Part(Sun_Jul_29_10:51:05_2001_767)--"
Content-Transfer-Encoding: 7bit
Reply-To: man-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+010328
X-Sequence: man-jp 3629
Subject: [man-jp 3629] ja-less+iso-358.254 bold+underline patch
Errors-To: owner-man-jp@jp.freebsd.org
Sender: owner-man-jp@jp.freebsd.org
X-Originator: moriko@hh.iij4u.or.jp

----Next_Part(Sun_Jul_29_10:51:05_2001_767)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit

$B?9$G$9!#(B[man-jp 3628] $B$G=q$$$?$3$H$K$D$$$FD4$Y$^$7$?!#(B

> # kterm + jless $B;HMQ$N>l9g!#$?$@$7(B $B%\!<%k%I(B+$B%$%?%j%C%/$GI=<($5$l$k$Y$-(B
> # $B$H$3$m$O$OC1$J$k%\!<%k%I$H$7$FI=<($5$l$k!#$3$l$O$*$=$i$/(B kterm $B$+(B
> # jless $B$NLdBj!#$H$j$"$($:F|K\8l$H$OL54X78!#(B

$B%*%j%8%J%k$N(B less $B$G(B bold $B$H(B underline $B$r=E$M$k$i$l$k$h$&$K$J$C$F$$$J$$(B
$B$3$H$,!"$=$b$=$b$N860x$N$h$&$G$9!#(B

$B$3$l$K$D$$$F(B patch $B$r:n$C$F$_$^$7$?!#$^$@IT40A4$G$9$,!"$H$j$"$($:(B
groff $B$N(B BI (bold italic) font $B$N=PNO$r2<@~$D$-$N(B bold $B$G=PNO$G$-$k(B
$B$h$&$K$J$C$F$$$^$9!#(B[man-jp 3628] $B$N(B groff patch $B$H$"$o$;$l$P(B
$BF|K\8l$b2<@~$D$-$N%\!<%k%I$G=PNO$5$l$k$O$:$G$9!#(B

# $B$b$A$m$s(B kterm $B$GF|K\8l$N%\!<%k%I$,;H$($k$h$&$K4D6-$r@_Dj$9$kI,MW$,(B
# $B$"$j$^$9!#(B

$BE:IU$N(B patch $B$r(B /usr/ports/japanese/less/files $B$K$*$$$F:n@.$7$J$*$7$?(B
jless $B$r;H$C$F0J2<$N$h$&$K$7$F3NG'$9$k$3$H$,$G$-$^$9!#(B


$ cat test.nroff 
.ft I
italic $B%$%?%j%C%/(B

.ft B
bold $B%\!<%k%I(B

.ft BI
bold italic $B%\!<%k%I%$%?%j%C%/(B

$ nkf -e test.nroff | /usr/local/bin/groff -Tnippon | jless -sEX


$B$H$3$m$G(B man $B$G%\!<%k%I%$%?%j%C%/$r;HMQ$7$F$$$k%1!<%9$O$"$k$N$G$7$g$&$+(B?
$B;DG0$J$,$iKM$OCN$j$^$;$s!#C/$+CN$C$F$?$i65$($F2<$5$$!#(B

-- 
$B?9(B $B9@Fs(B	(MORI Kouji)
E-mail: moriko@hh.iij4u.or.jp


----Next_Part(Sun_Jul_29_10:51:05_2001_767)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename=patch-za

diff -ur ../../work/less-358/less.h ./less.h
--- ../../work/less-358/less.h	Sat Jul 28 15:36:50 2001
+++ ./less.h	Sat Jul 28 15:07:21 2001
@@ -283,11 +283,11 @@
 
 /* Special chars used to tell put_line() to do something special */
 #define	AT_NORMAL	(0)
-#define	AT_UNDERLINE	(1)
-#define	AT_BOLD		(2)
-#define	AT_BLINK	(3)
-#define	AT_INVIS	(4)
-#define	AT_STANDOUT	(5)
+#define	AT_UNDERLINE	(1<<1)
+#define	AT_BOLD		(1<<2)
+#define	AT_BLINK	(1<<3)
+#define	AT_INVIS	(1<<4)
+#define	AT_STANDOUT	(1<<5)
 
 /*
  * Defines for multi character set and code set.
diff -ur ../../work/less-358/line.c ./line.c
--- ../../work/less-358/line.c	Sat Jul 28 15:36:50 2001
+++ ./line.c	Sat Jul 28 15:25:57 2001
@@ -293,14 +293,14 @@
 attr_swidth(a)
 	int a;
 {
-	switch (a)
-	{
-	case AT_BOLD:		return (bo_s_width);
-	case AT_UNDERLINE:	return (ul_s_width);
-	case AT_BLINK:		return (bl_s_width);
-	case AT_STANDOUT:	return (so_s_width);
-	}
-	return (0);
+  int w = 0;
+
+  w += a & AT_BOLD      ? bo_s_width : 0;
+  w += a & AT_UNDERLINE ? ul_s_width : 0;
+  w += a & AT_BLINK     ? bl_s_width : 0;
+  w += a & AT_STANDOUT  ? so_s_width : 0;
+
+  return w;
 }
 
 /*
@@ -311,14 +311,14 @@
 attr_ewidth(a)
 	int a;
 {
-	switch (a)
-	{
-	case AT_BOLD:		return (bo_e_width);
-	case AT_UNDERLINE:	return (ul_e_width);
-	case AT_BLINK:		return (bl_e_width);
-	case AT_STANDOUT:	return (so_e_width);
-	}
-	return (0);
+  int w = 0;
+
+  w += a & AT_BOLD      ? bo_s_width : 0;
+  w += a & AT_UNDERLINE ? ul_s_width : 0;
+  w += a & AT_BLINK     ? bl_s_width : 0;
+  w += a & AT_STANDOUT  ? so_s_width : 0;
+
+  return w;
 }
 
 /*
@@ -616,7 +616,7 @@
 		if (CSISWRONG(cs) && control_char(c))
 			goto do_control_char;
 		if ((char)c == linebuf[curr] && charset[curr] == cs)
-			STOREC(c, cs, AT_BOLD);
+			STOREC(c, cs, AT_BOLD | attr[curr]);
 		else if (c == '_' && CSISASCII(cs))
 		{
 			STOREC(linebuf[curr], charset[curr], AT_UNDERLINE);
diff -ur ../../work/less-358/output.c ./output.c
--- ../../work/less-358/output.c	Sat Jul 28 15:36:50 2001
+++ ./output.c	Sat Jul 28 15:07:21 2001
@@ -67,20 +67,17 @@
 			 * Display the exit sequence for the old attribute
 			 * and the enter sequence for the new one.
 			 */
-			switch (curr_attr)
-			{
-			case AT_UNDERLINE:	ul_exit();	break;
-			case AT_BOLD:		bo_exit();	break;
-			case AT_BLINK:		bl_exit();	break;
-			case AT_STANDOUT:	so_exit();	break;
-			}
-			switch (a)
-			{
-			case AT_UNDERLINE:	ul_enter();	break;
-			case AT_BOLD:		bo_enter();	break;
-			case AT_BLINK:		bl_enter();	break;
-			case AT_STANDOUT:	so_enter();	break;
-			}
+
+		  if (curr_attr & AT_UNDERLINE)  ul_exit();
+		  if (curr_attr & AT_BOLD)       bo_exit();
+		  if (curr_attr & AT_BLINK)      bl_exit();
+		  if (curr_attr & AT_STANDOUT)   so_exit();
+
+		  if (a & AT_UNDERLINE)  ul_enter();
+		  if (a & AT_BOLD)       bo_enter();
+		  if (a & AT_BLINK)      bl_enter();
+		  if (a & AT_STANDOUT)   so_enter();
+
 			curr_attr = a;
 		}
 		if (curr_attr == AT_INVIS)
@@ -95,13 +92,11 @@
 #endif
 	}
 
-	switch (curr_attr)
-	{
-	case AT_UNDERLINE:	ul_exit();	break;
-	case AT_BOLD:		bo_exit();	break;
-	case AT_BLINK:		bl_exit();	break;
-	case AT_STANDOUT:	so_exit();	break;
-	}
+	if (curr_attr & AT_UNDERLINE)  ul_exit();
+	if (curr_attr & AT_BOLD)       bo_exit();
+	if (curr_attr & AT_BLINK)      bl_exit();
+	if (curr_attr & AT_STANDOUT)   so_exit();
+
 	final_attr = curr_attr;
 }
 
diff -ur ../../work/less-358/screen.c ./screen.c
--- ../../work/less-358/screen.c	Sun Jul  9 09:26:47 2000
+++ ./screen.c	Sat Jul 28 15:07:21 2001
@@ -1947,32 +1947,18 @@
 	 * cleared area with the current attribute.
 	 */
 	lower_left();
-	switch (attrmode)
-	{
-	case AT_STANDOUT:
-		so_exit();
-		clear_eol_bot();
-		so_enter();
-		break;
-	case AT_UNDERLINE:
-		ul_exit();
-		clear_eol_bot();
-		ul_enter();
-		break;
-	case AT_BOLD:
-		bo_exit();
-		clear_eol_bot();
-		bo_enter();
-		break;
-	case AT_BLINK:
-		bl_exit();
-		clear_eol_bot();
-		bl_enter();
-		break;
-	default:
-		clear_eol_bot();
-		break;
-	}
+
+	if (attrmode & AT_STANDOUT)  so_exit();
+	if (attrmode & AT_UNDERLINE) ul_exit();
+	if (attrmode & AT_BOLD)      bo_exit();
+	if (attrmode & AT_BLINK)     bl_exit();
+
+	clear_eol_bot();
+
+	if (attrmode & AT_STANDOUT)  so_enter();
+	if (attrmode & AT_UNDERLINE) ul_enter();
+	if (attrmode & AT_BOLD)      bo_enter();
+	if (attrmode & AT_BLINK)     bl_enter();
 }
 
 /*
@@ -1987,7 +1973,7 @@
 	flush();
 	SETCOLORS(so_fg_color, so_bg_color);
 #endif
-	attrmode = AT_STANDOUT;
+	attrmode |= AT_STANDOUT;
 }
 
 /*
@@ -2002,7 +1988,7 @@
 	flush();
 	SETCOLORS(nm_fg_color, nm_bg_color);
 #endif
-	attrmode = AT_NORMAL;
+	attrmode &= ~AT_STANDOUT;
 }
 
 /*
@@ -2018,7 +2004,7 @@
 	flush();
 	SETCOLORS(ul_fg_color, ul_bg_color);
 #endif
-	attrmode = AT_UNDERLINE;
+	attrmode |= AT_UNDERLINE;
 }
 
 /*
@@ -2033,7 +2019,7 @@
 	flush();
 	SETCOLORS(nm_fg_color, nm_bg_color);
 #endif
-	attrmode = AT_NORMAL;
+	attrmode &= ~AT_UNDERLINE;
 }
 
 /*
@@ -2048,7 +2034,7 @@
 	flush();
 	SETCOLORS(bo_fg_color, bo_bg_color);
 #endif
-	attrmode = AT_BOLD;
+	attrmode |= AT_BOLD;
 }
 
 /*
@@ -2063,7 +2049,7 @@
 	flush();
 	SETCOLORS(nm_fg_color, nm_bg_color);
 #endif
-	attrmode = AT_NORMAL;
+	attrmode &= ~AT_BOLD;
 }
 
 /*
@@ -2078,7 +2064,7 @@
 	flush();
 	SETCOLORS(bl_fg_color, bl_bg_color);
 #endif
-	attrmode = AT_BLINK;
+	attrmode |= AT_BLINK;
 }
 
 /*
@@ -2093,7 +2079,7 @@
 	flush();
 	SETCOLORS(nm_fg_color, nm_bg_color);
 #endif
-	attrmode = AT_NORMAL;
+	attrmode &= ~AT_BLINK;
 }
 
 #if 0 /* No longer used */

----Next_Part(Sun_Jul_29_10:51:05_2001_767)----
