From owner-freebsd-bugs Sun Jan 19 12:50: 7 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 38CE737B401 for ; Sun, 19 Jan 2003 12:50:04 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8E81D43F5B for ; Sun, 19 Jan 2003 12:50:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h0JKo2NS047202 for ; Sun, 19 Jan 2003 12:50:02 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h0JKo2CV047201; Sun, 19 Jan 2003 12:50:02 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 90DDE37B401 for ; Sun, 19 Jan 2003 12:47:06 -0800 (PST) Received: from community6.interfree.it (community6.interfree.it [213.158.72.46]) by mx1.FreeBSD.org (Postfix) with SMTP id 8DA2543E4A for ; Sun, 19 Jan 2003 12:47:01 -0800 (PST) (envelope-from nivit@libero.it) Received: (qmail 3798 invoked from network); 19 Jan 2003 20:46:59 -0000 Received: from unknown (HELO coryphantha) (151.35.185.162) by mail.interfree.it with SMTP; 19 Jan 2003 20:46:59 -0000 Received: (qmail 428 invoked by uid 1002); 19 Jan 2003 12:56:47 -0000 Message-Id: <20030119125647.427.qmail@Coryphantha.DOMO.SVA> Date: 19 Jan 2003 12:56:47 -0000 From: nivit@libero.it (Nicola Vitale) Reply-To: Nicola Vitale To: FreeBSD-gnats-submit@FreeBSD.org Cc: Nicola Vitale X-Send-Pr-Version: 3.113 Subject: i386/47223: [PATCH] pcvt(4), ESC sequences do not change colors correctly Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 47223 >Category: i386 >Synopsis: [PATCH] pcvt(4), ESC sequences do not change colors correctly >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Jan 19 12:50:01 PST 2003 >Closed-Date: >Last-Modified: >Originator: Nicola Vitale >Release: FreeBSD 4.7-STABLE i386 >Organization: >Environment: System: FreeBSD Coryphantha.DOMO.SVA 4.7-STABLE FreeBSD 4.7-STABLE #221: Sun Jan 19 10:31:38 CET 2003 stan@Coryphantha.DOMO.SVA:/usr/obj/usr/src/sys/Coryphantha i386 Console driver: pcvt(4) >Description: The pcvt driver changes the foreground and background colors correctly, only if you send one escape sequence with two parameters: ESC[;m If you change only one color at the time, e.g., with: ESC[m (or both colors with two separate escape sequences) the driver resets the other one (in this case foreground) to black. So it is impossible to display/use colors with programs such as mutt, midc, lynx, etc, which send a separate sequence for each color. >How-To-Repeat: [In a csh] alias esc[p 'printf "\033[%sm%s\n"' alias esc[pp 'printf "\033[%s;%sm%s\n"' scon -pbrown,63,63,21 [the following commands print 'querty' with yellow/blue colors (correctly), and then reset attributes] esc[pp 33 44 qwerty ; esc[p [Now repeat changing, for example, only the foreground to yellow] esc[p 33 [then, background to blue and printing 'qwerty'] esc[p 45 qwerty ; esc[p [you get 'qwerty' in black/blue, not yellow/blue]. scon -p default You can see also strange effects with mutt, lynx, etc. (TERM=vt220-color). >Fix: --- src/sys/i386/isa/pcvt/pcvt_vtf.c Thu Dec 30 17:17:11 1999 +++ src/sys/i386/isa/pcvt/pcvt_vtf.c.new Sun Jan 19 10:17:14 2003 @@ -120,7 +120,8 @@ vt_sgr(struct video_state *svsp) { register int i = 0; - u_short setcolor = 0; + u_short fg_color = svsp->c_attr & (7 << 8); + u_short bg_color = svsp->c_attr & (0xF0 << 8); char colortouched = 0; do @@ -174,7 +175,7 @@ if(color) { colortouched = 1; - setcolor |= ((fgansitopc[(svsp->parms[i-1]-30) & 7]) << 8); + fg_color = ((fgansitopc[(svsp->parms[i-1]-30) & 7]) << 8); } break; @@ -189,7 +190,7 @@ if(color) { colortouched = 1; - setcolor |= ((bgansitopc[(svsp->parms[i-1]-40) & 7]) << 8); + bg_color = ((bgansitopc[(svsp->parms[i-1]-40) ] & 0xF0 ) << 8); } break; } @@ -198,7 +199,7 @@ if(color) { if(colortouched) - svsp->c_attr = setcolor; + svsp->c_attr = fg_color | bg_color; else svsp->c_attr = ((sgr_tab_color[svsp->vtsgr]) << 8); } >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message