From owner-freebsd-arch Fri Oct 18 2:53:51 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EE94D37B401 for ; Fri, 18 Oct 2002 02:53:44 -0700 (PDT) Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id E8DF243E6E for ; Fri, 18 Oct 2002 02:53:34 -0700 (PDT) (envelope-from ru@whale.sunbay.crimea.ua) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.6/8.11.2) id g9I9oQ626710; Fri, 18 Oct 2002 12:50:26 +0300 (EEST) (envelope-from ru) Date: Fri, 18 Oct 2002 12:50:26 +0300 From: Ruslan Ermilov To: "M. Warner Losh" Cc: arch@FreeBSD.ORG Subject: Re: color, again, in grotty Message-ID: <20021018095026.GA3386@sunbay.com> References: <20021017.101833.110719994.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="98e8jtXdkpgskNou" Content-Disposition: inline In-Reply-To: <20021017.101833.110719994.imp@bsdimp.com> User-Agent: Mutt/1.3.99i Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --98e8jtXdkpgskNou Content-Type: multipart/mixed; boundary="HcAYCG3uE/tztfnV" Content-Disposition: inline --HcAYCG3uE/tztfnV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable [Before I start my speech: I have disabled the SGR support in grotty(1) completely until we get the resolution here. This does not of course affect the non-TTY groff(1) devices like -Tps, -TX100, etc.] On Thu, Oct 17, 2002 at 10:18:33AM -0600, M. Warner Losh wrote: > OK. Something is really broken with the latest groff. >=20 > nroff -mandoc devd.8 | more > UNTITLED LOCAL UNT= ITLED >=20 > ESC[1mNAMEESC[0m > ESC[1mdevd ESC[22m- Device state change daemon >=20 >=20 > etc >=20 > Notice that it now bogusly and wrongly contains escape characters. > This is wrong wrong wrong and must be fixed. Color is cool, but > putting it in nroff is absolutely the worst and wrongest place one can > put it. Why is it done this way? Can't it be fixed? >=20 This is only one opinion, and there exist others I would like you to listen to before judging: http://people.freebsd.org/~ru/grotty-SGR.mbox.gz (25 messages thread) Only a few quotes in support of colors, if you permit: : > Well, if the SGR escapes are on by default, I'd think you do need to : > consider the effects that will have on popular terminals. AFAIK, : > even the majority of xterm versions don't support colors, outside : > the GNU/Linux world. :=20 : The eternal question whether we shall follow a standard or not... : ISO 6429 is from 1991 -- isn't eleven years enough to wait? :=20 : > Didn't you say that you also use SGR for bold and underline? That : > would produce similar problems for terminals whose bold and : > underline commands are not SGR, right? :=20 : Do you think there are terminals which have SGR sequences for : activating colors and non-SGR sequences for activating bold and : underline? If you read the thread, I am pretty sure you will get the same feeling as I am -- it is that the new ANSI SGR escapes became the new standard for TTY-type output devices serviced with grotty(1), and nroff(1). Our default pager (less/more) also supports this feature through the -R option, as does the new -R option in the new info(1). We have also learned one pitfall with this new approach. Our default terminal driver, syscons(4), renders the "underscore" attribute, SGR E[4m (see screen(4)), the same as bold, which is the (code documented) bug, so using this new SGR scheme directly as it comes with new Groff worsens the output on cons25* type terminals. On the other hand, classical nroff(1) filters like ul(1) (and not by accident less(1)) render underlining with the "reverse" attribute on terminals that do not support underlining, like cons25. So we must either fix syscons(4) or to somehow tell grotty(1) to emit old sequences to print bold and italic characters. I have prepared and sent the patch to Groff maintainers that tells grotty(1) to use the old scheme for printing bold and italic characters, but otherwise have color output enabled. Today I have tried a different approach ("fixing" the driver), and was surprised by the unexpected good results -- I have changed the syscons(4) so that it renders "underscore" with "reverse", and I can now differentiate all three bold (bold attr), italic (underline attr), and bold+italic (bold+underline attrs) fonts (and colors!) on a cons25 TTY. There are three ways we can go here: 1. Disable SGR support for grotty(1). It can be soft-disabled by setting GROFF_NO_SGR in environment, or hard-disabled system-wide (like it is now in -CURRENT as of this writing) in /usr/share/tmac/troffrc. 2. Stay compatible with the new standard (11 years old ANSI std). This means we fix syscons(4) so that it renders "underscore" distinguishable from "bold", and change the default pager to "more -R". There will still be an option of soft-disabling it for those who want it disabled. I suggest option 2 for 5.0-CURRENT and soft option 1 (soft version) for 4.7-STABLE (once I import the new Groff into RELENG_4). Patch for option 2 is included. Soft option 1 would also require modifying src/etc/login.conf to add GROFF_NO_SGR to environment. Cheers, --=20 Ruslan Ermilov Sysadmin and DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age --HcAYCG3uE/tztfnV Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p Content-Transfer-Encoding: quoted-printable Index: sys/dev/syscons/scterm-sc.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/dev/syscons/scterm-sc.c,v retrieving revision 1.17 diff -u -r1.17 scterm-sc.c --- sys/dev/syscons/scterm-sc.c 12 Sep 2001 08:37:13 -0000 1.17 +++ sys/dev/syscons/scterm-sc.c 18 Oct 2002 09:50:24 -0000 @@ -797,7 +797,8 @@ { int attr, mask =3D tcp->attr_mask; =20 - if (mask & REVERSE_ATTR) { + /* XXX: underline mapping for Hercules adapter can be better */ + if (mask & (REVERSE_ATTR | UNDERLINE_ATTR)) { attr =3D ((mask & FG_CHANGED) ? tcp->cur_color.bg : tcp->rev_color.fg) | (((mask & BG_CHANGED) ? @@ -805,8 +806,7 @@ } else attr =3D tcp->cur_color.fg | (tcp->cur_color.bg << 4); =20 - /* XXX: underline mapping for Hercules adapter can be better */ - if (mask & (BOLD_ATTR | UNDERLINE_ATTR)) + if (mask & BOLD_ATTR) attr ^=3D 0x08; if (mask & BLINK_ATTR) attr ^=3D 0x80; Index: contrib/groff/tmac/troffrc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/contrib/groff/tmac/troffrc,v retrieving revision 1.11 diff -u -r1.11 troffrc --- contrib/groff/tmac/troffrc 18 Oct 2002 09:10:44 -0000 1.11 +++ contrib/groff/tmac/troffrc 18 Oct 2002 09:50:24 -0000 @@ -45,7 +45,4 @@ . .\} . -.\" Disable SGR support in grotty(1). -.if n .do nop \X'tty: sgr 0'\c -. .\" Don't let blank lines creep in here. Index: etc/root/dot.cshrc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/etc/root/dot.cshrc,v retrieving revision 1.28 diff -u -r1.28 dot.cshrc --- etc/root/dot.cshrc 10 Jan 2001 02:37:16 -0000 1.28 +++ etc/root/dot.cshrc 18 Oct 2002 09:50:19 -0000 @@ -17,7 +17,7 @@ set path =3D (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /us= r/local/bin /usr/X11R6/bin $HOME/bin) =20 setenv EDITOR vi -setenv PAGER more +setenv PAGER "more -R" setenv BLOCKSIZE K =20 if ($?prompt) then Index: etc/root/dot.profile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/etc/root/dot.profile,v retrieving revision 1.20 diff -u -r1.20 dot.profile --- etc/root/dot.profile 27 Aug 1999 23:24:09 -0000 1.20 +++ etc/root/dot.profile 18 Oct 2002 09:50:19 -0000 @@ -6,5 +6,5 @@ export HOME TERM=3D${TERM:-cons25} export TERM -PAGER=3Dmore +PAGER=3D"more -R" export PAGER Index: share/skel/dot.cshrc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/share/skel/dot.cshrc,v retrieving revision 1.13 diff -u -r1.13 dot.cshrc --- share/skel/dot.cshrc 10 Jan 2001 17:35:28 -0000 1.13 +++ share/skel/dot.cshrc 18 Oct 2002 09:50:19 -0000 @@ -17,7 +17,7 @@ set path =3D (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /us= r/local/bin /usr/X11R6/bin $HOME/bin) =20 setenv EDITOR vi -setenv PAGER more +setenv PAGER "more -R" setenv BLOCKSIZE K =20 if ($?prompt) then Index: share/skel/dot.profile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/share/skel/dot.profile,v retrieving revision 1.21 diff -u -r1.21 dot.profile --- share/skel/dot.profile 7 Jul 2002 00:00:54 -0000 1.21 +++ share/skel/dot.profile 18 Oct 2002 09:50:19 -0000 @@ -16,7 +16,7 @@ =20 BLOCKSIZE=3DK; export BLOCKSIZE EDITOR=3Dvi; export EDITOR -PAGER=3Dmore; export PAGER +PAGER=3D"more -R"; export PAGER =20 # set ENV to a file invoked each time sh is started for interactive use. ENV=3D$HOME/.shrc; export ENV --HcAYCG3uE/tztfnV-- --98e8jtXdkpgskNou Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD) iD8DBQE9r9liUkv4P6juNwoRAgobAKCCAjApHRxBOMYXV5eFs+4EeU91/QCfb7Zk DULnn6uPbtohd0OR5r8k+cM= =nNDK -----END PGP SIGNATURE----- --98e8jtXdkpgskNou-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message