NetBSD Problem Report #18004

Received: (qmail 22866 invoked by uid 605); 20 Aug 2002 12:37:51 -0000
Message-Id: <20020820123738.E3AB046A4@stasis.kittenz.org>
Date: Tue, 20 Aug 2002 13:37:38 +0100 (BST)
From: xs@kittenz.org
Sender: gnats-bugs-owner@netbsd.org
Reply-To: xs@kittenz.org
To: gnats-bugs@gnats.netbsd.org
Subject: support for changing default vt100 underline/highlight colours
X-Send-Pr-Version: 3.95

>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:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 20 12:38:00 +0000 2002
>Closed-Date:    Wed Apr 02 18:24:02 +0000 2003
>Last-Modified:  Wed Apr 02 18:25:00 +0000 2003
>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:
State-Changed-From-To: open->closed 
State-Changed-By: drochner 
State-Changed-When: Wed Apr 2 10:23:35 PST 2003 
State-Changed-Why:  
patch applied, thanks 

From: Matthias Drochner <drochner@netbsd.org>
To: gnats-bugs@gnats.netbsd.org
Cc:  
Subject: pr/18004 CVS commit: src/sys/dev/wscons
Date: Wed,  2 Apr 2003 21:22:57 +0300 (EEST)

 Module Name:	src
 Committed By:	drochner
 Date:		Wed Apr  2 18:22:57 UTC 2003

 Modified Files:
 	src/sys/dev/wscons: files.wscons wsemul_vt100_subr.c

 Log Message:
 allow to customize how highlighting and underlining text is substituted
 if the display doesn't provide this
 submitted by xs@kittenz.org per PR kern/18004


 To generate a diff of this commit:
 cvs rdiff -r1.27 -r1.28 src/sys/dev/wscons/files.wscons
 cvs rdiff -r1.13 -r1.14 src/sys/dev/wscons/wsemul_vt100_subr.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.