Subject: kern/18004: support for changing default vt100 underline/highlight colours
To: None <gnats-bugs@gnats.netbsd.org>
From: None <xs@kittenz.org>
List: netbsd-bugs
Date: 08/20/2002 13:37:38
>Number:         18004
>Category:       kern
>Synopsis:       support for changing default vt100 underline/highlight colours
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 20 05:38:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        NetBSD 1.6F
>Organization:
>Environment:
/sys/dev/wscons/files.wscons:
     $NetBSD: files.wscons,v 1.27 2002/07/02 12:59:39 itojun Exp $
System: NetBSD stasis 1.6F NetBSD 1.6F (STASIS) #3: Tue Aug 20 10:43:46 BST 2002 xs@stasis:/usr/src/sys/arch/i386/compile/STASIS i386
Architecture: i386
Machine: i386
>Description:
	When the capability to underline or highlight text on a screen is 
	not present but the screen is capable of colour, the vt100 emulation
	forces the colour of the foreground colour of highlighted text to
	red, and the background colour of underlined text to brown. (orange.)

	These colours are not always optimal for all displays or eyes, thus
	it would be nice if they were adjustable, like the kernel fg/bg
	output colours, without digging into wsemul_vt100_subr.c.

>How-To-Repeat:
	echo -e '\e[4mgroovy\e[0m'

>Fix:
This change allows:

	options WSEMUL_VT100_UNDERLINE_BG=-1
	options WSEMUL_VT100_UNDERLINE_FG=WSCOL_CYAN

in the kernel configuration, which results in a colour style similar to
that in OpenBSD.

Index: files.wscons
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/wscons/files.wscons,v
retrieving revision 1.27
diff -u -r1.27 files.wscons
--- files.wscons	2002/07/02 12:59:39	1.27
+++ files.wscons	2002/08/20 12:06:16
@@ -14,6 +14,8 @@
 
 defparam opt_wsemul.h		WSEMUL_DEFAULT
 defflag	opt_wsemul.h		WSEMUL_NO_DUMB WSEMUL_SUN WSEMUL_VT100
+defparam opt_wsemul.h		WSEMUL_VT100_HILIT_FG WSEMUL_VT100_UNDERLINE_FG
+				WSEMUL_VT100_HILIT_BG WSEMUL_VT100_UNDERLINE_BG
 defparam opt_wskernattr.h	WS_KERNEL_FG WS_KERNEL_BG
 				WS_KERNEL_COLATTR WS_KERNEL_MONOATTR
 defflag	opt_wsdisplay_compat.h	WSDISPLAY_COMPAT_USL
Index: wsemul_vt100_subr.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/wscons/wsemul_vt100_subr.c,v
retrieving revision 1.11
diff -u -r1.11 wsemul_vt100_subr.c
--- wsemul_vt100_subr.c	2002/07/04 14:37:15	1.11
+++ wsemul_vt100_subr.c	2002/08/20 12:06:18
@@ -43,6 +43,8 @@
 #include <dev/wscons/wsemulvar.h>
 #include <dev/wscons/wsemul_vt100var.h>
 
+#include "opt_wsemul.h"
+
 static int vt100_selectattribute(struct wsemul_vt100_emuldata *,
 				      int, int, int, long *, long *);
 static int vt100_ansimode(struct wsemul_vt100_emuldata *, int, int);
@@ -642,7 +644,14 @@
 	    !(edp->scrcapabilities & WSSCREEN_HILIT)) {
 		flags &= ~WSATTR_HILIT;
 		if (edp->scrcapabilities & WSSCREEN_WSCOLORS) {
+#if defined(WSEMUL_VT100_HILIT_FG) && WSEMUL_VT100_HILIT_FG != -1
+			fgcol = WSEMUL_VT100_HILIT_FG;
+#elif !defined(WSEMUL_VT100_HILIT_FG)
 			fgcol = WSCOL_RED;
+#endif
+#if defined(WSEMUL_VT100_HILIT_BG) && WSEMUL_VT100_HILIT_BG != -1
+			bgcol = WSEMUL_VT100_HILIT_BG;
+#endif
 			flags |= WSATTR_WSCOLORS;
 		} else {
 #ifdef VT100_DEBUG
@@ -654,8 +663,14 @@
 	    !(edp->scrcapabilities & WSSCREEN_UNDERLINE)) {
 		flags &= ~WSATTR_UNDERLINE;
 		if (edp->scrcapabilities & WSSCREEN_WSCOLORS) {
+#if defined(WSEMUL_VT100_UNDERLINE_FG) && WSEMUL_VT100_UNDERLINE_FG != -1
+			fgcol = WSEMUL_VT100_UNDERLINE_FG;
+#endif
+#if defined(WSEMUL_VT100_UNDERLINE_BG) && WSEMUL_VT100_UNDERLINE_BG != -1
+			bgcol = WSEMUL_VT100_UNDERLINE_BG;
+#elif !defined(WSEMUL_VT100_UNDERLINE_BG)
 			bgcol = WSCOL_BROWN;
-			flags &= ~WSATTR_UNDERLINE;
+#endif
 			flags |= WSATTR_WSCOLORS;
 		} else {
 #ifdef VT100_DEBUG

>Release-Note:
>Audit-Trail:
>Unformatted: