Date: 19 Jan 2003 12:56:47 -0000 From: nivit@libero.it (Nicola Vitale) To: FreeBSD-gnats-submit@FreeBSD.org Cc: Nicola Vitale <nivit@libero.it> Subject: i386/47223: [PATCH] pcvt(4), ESC sequences do not change colors correctly Message-ID: <20030119125647.427.qmail@Coryphantha.DOMO.SVA>
next in thread | raw e-mail | index | archive | help
>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[<FG_COLOR>;<BG_COLOR>m If you change only one color at the time, e.g., with: ESC[<BG_COLOR>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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030119125647.427.qmail>