From: lhall AT rfk DOT com (Larry Hall) Subject: console.cc patch for console colors 9 Mar 1998 00:03:36 -0800 Message-ID: <3.0.5.32.19980308234906.009a9e90.cygnus.gnu-win32@pop.ma.ultranet.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=====================_889436946==_" To: noer AT cygnus DOT com Cc: jman AT lx DOT net, gnu-win32 AT cygnus DOT com --=====================_889436946==_ Content-Type: text/plain; charset="us-ascii" I'm happy to announce that I've made my first patch for cygwinb19.dll! Big deal, I know. I've included the patch below for those interested. The patch fixes bugs and adds functionality to terminal color handling facilities in cygwinb19.dll (console.cc). The first patch includes the changes made to the console.cc file by Sergey's "morefcntl.diff" patch from March 5, 1998. I've also added and enabled a little functionality (dim and invisible console modes) that you'll need the termcap patch to get access to. For those who want to just use changes rather than build them, I've uploaded a zip file called cygwinDLLwithConsoleColorPatch.zip to the incoming directory on ftp.deninc.com. Hopefully it will be moved to a more appropriate spot soon. The zip file contains a prebuilt DLL on top of all patches from Sergey as of March 5, 1998 plus a patch that was posted to the list that was supposed to fix the ash quote bug. I haven't tested any of these patches (other than my own). I have tried out my changes with the ncurses.exe program from the ncurses 4.1 distribution as well as with vim 5.0 release using the syntax highlighting. It seems to work well for me. If you don't like having a black background and white foreground, this patch is for you!;-) Questions and flames can be directed to me specifically. I'll post them to the list if they seem of general interest. Thanks to Chris Faylor for his help over the last few months and specifically for fixing some nasty scrolling bugs in b19! You saved me some extra bug-fixing effort!;-) --=====================_889436946==_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="consolecolorandfnctl.diff" *** winsup/console.cc.orig Thu Feb 19 17:36:34 1998 --- winsup/console.cc Sun Mar 08 22:56:20 1998 *************** *** 12,17 **** --- 12,18 ---- #include #include #include + #include #include "winsup.h" #define srTop (info.winTop + scroll_region.Top) *************** *** 455,461 **** fhandler_console::fhandler_console (const char *name) : fhandler_tty= (name) { state_ =3D normal; ! default_color =3D FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED; } /* --- 456,465 ---- fhandler_console::fhandler_console (const char *name) : fhandler_tty= (name) { state_ =3D normal; ! if (fillin_info ()) ! default_color =3D info.wAttributes; ! else ! default_color =3D FOREGROUND_BLUE | FOREGROUND_GREEN |= FOREGROUND_RED; } /* *************** *** 596,602 **** void fhandler_console::char_command (char c) { ! static int fg =3D 7, bg =3D 0, bold =3D 0; int x, y; char buf[40]; --- 600,612 ---- void fhandler_console::char_command (char c) { ! // Keep the background intensity with the colr since there doesn't= seem ! // to be a way to set this with termcap/terminfo. ! static int fg =3D default_color & (FOREGROUND_BLUE | FOREGROUND_GREEN= | ! FOREGROUND_RED), ! bg =3D default_color & (BACKGROUND_BLUE | BACKGROUND_GREEN |= ! BACKGROUND_RED |= BACKGROUND_INTENSITY), ! bold =3D default_color & FOREGROUND_INTENSITY; int x, y; char buf[40]; *************** *** 609,643 **** switch (args_[i]) { case 0: /* normal color */ ! fg =3D default_color; ! bg =3D 0; ! bold =3D 0; break; case 1: /* bold */ ! fg =3D default_color; ! bg =3D 0; bold =3D FOREGROUND_INTENSITY; break; case 4: /* underline - simulate with magenta */ fg =3D FOREGROUND_BLUE | FOREGROUND_RED; ! bold =3D FOREGROUND_INTENSITY; ! bg =3D 0; ! break; ! case 5: ! fg =3D default_color; ! bg =3D 0; ! bold =3D FOREGROUND_INTENSITY | BACKGROUND_INTENSITY; break; case 7: /* reverse */ ! fg =3D 0; ! bg =3D BACKGROUND_BLUE | BACKGROUND_GREEN |= BACKGROUND_RED; ! bold =3D 0; break; case 8: /* invisible */ ! fg =3D 0; ! bg =3D 0; ! bold =3D 0; ! break; case 30: /* BLACK foreground */ fg =3D 0; break; --- 619,678 ---- switch (args_[i]) { case 0: /* normal color */ ! fg =3D default_color & (FOREGROUND_BLUE | FOREGROUND_GREEN= | ! FOREGROUND_RED); ! bg =3D default_color & (BACKGROUND_BLUE | BACKGROUND_GREEN= | ! BACKGROUND_RED |= BACKGROUND_INTENSITY); ! bold =3D default_color & FOREGROUND_INTENSITY; break; case 1: /* bold */ ! fg =3D default_color & (FOREGROUND_BLUE | FOREGROUND_GREEN= | ! FOREGROUND_RED); ! bg =3D default_color & (BACKGROUND_BLUE | BACKGROUND_GREEN= | ! BACKGROUND_RED |= BACKGROUND_INTENSITY); bold =3D FOREGROUND_INTENSITY; break; case 4: /* underline - simulate with magenta */ fg =3D FOREGROUND_BLUE | FOREGROUND_RED; ! bg =3D default_color & (BACKGROUND_BLUE | BACKGROUND_GREEN= | ! BACKGROUND_RED |= BACKGROUND_INTENSITY); ! bold =3D default_color & FOREGROUND_INTENSITY; ! break; ! case 5: /* blink mode */ ! fg =3D default_color & (FOREGROUND_BLUE | FOREGROUND_GREEN= | ! FOREGROUND_RED); ! bg =3D default_color & (BACKGROUND_BLUE | BACKGROUND_GREEN= | ! BACKGROUND_RED |= BACKGROUND_INTENSITY); ! bold =3D default_color & FOREGROUND_INTENSITY; break; case 7: /* reverse */ ! fg =3D (default_color & BACKGROUND_BLUE) ? FOREGROUND_BLUE= : 0; ! fg |=3D (default_color & BACKGROUND_GREEN) ?= FOREGROUND_GREEN : 0; ! fg |=3D (default_color & BACKGROUND_RED) ? FOREGROUND_RED := 0; ! fg |=3D (default_color & BACKGROUND_INTENSITY) ? ! FOREGROUND_INTENSITY : 0; ! bg =3D (default_color & FOREGROUND_BLUE) ? BACKGROUND_BLUE= : 0; ! bg |=3D (default_color & FOREGROUND_GREEN) ?= BACKGROUND_GREEN : 0; ! bg |=3D (default_color & FOREGROUND_RED) ? BACKGROUND_RED := 0; ! bg |=3D (default_color & FOREGROUND_INTENSITY) ? ! BACKGROUND_INTENSITY : 0; break; case 8: /* invisible */ ! fg =3D (default_color & BACKGROUND_BLUE) ? FOREGROUND_BLUE= : 0; ! fg |=3D (default_color & BACKGROUND_GREEN) ?= FOREGROUND_GREEN : 0; ! fg |=3D (default_color & BACKGROUND_RED) ? FOREGROUND_RED := 0; ! bg =3D default_color & (BACKGROUND_BLUE | BACKGROUND_GREEN= | ! BACKGROUND_RED |= BACKGROUND_INTENSITY); ! bold =3D (default_color & BACKGROUND_INTENSITY) ? ! FOREGROUND_INTENSITY : 0; ! break; ! case 9: /* dim */ ! fg =3D default_color & (FOREGROUND_BLUE | FOREGROUND_GREEN | ! FOREGROUND_RED); ! bg =3D default_color & (BACKGROUND_BLUE | BACKGROUND_GREEN= | ! BACKGROUND_RED |= BACKGROUND_INTENSITY); ! bold =3D (fg =3D=3D 0) ? FOREGROUND_INTENSITY : 0; ! break; case 30: /* BLACK foreground */ fg =3D 0; break; *************** *** 687,695 **** bg =3D BACKGROUND_BLUE | BACKGROUND_GREEN |= BACKGROUND_RED; break; default: ! fg =3D default_color; ! bg =3D 0; ! bold =3D 0; break; } SetConsoleTextAttribute (get_output_handle (), fg | bg |= bold); --- 722,732 ---- bg =3D BACKGROUND_BLUE | BACKGROUND_GREEN |= BACKGROUND_RED; break; default: ! fg =3D default_color & (FOREGROUND_BLUE | FOREGROUND_GREEN= | ! FOREGROUND_RED); ! bg =3D default_color & (BACKGROUND_BLUE | BACKGROUND_GREEN= | ! BACKGROUND_RED |= BACKGROUND_INTENSITY); ! bold =3D default_color & FOREGROUND_INTENSITY; break; } SetConsoleTextAttribute (get_output_handle (), fg | bg |= bold); *************** *** 1435,1441 **** fhandler_tty::init (f, bin, a, n); /* Ensure both input and output console handles are open */ ! open (0,0); /* IGNCR doesn't work yet */ t.c_iflag =3D ICRNL /* | IGNCR */; --- 1472,1487 ---- fhandler_tty::init (f, bin, a, n); /* Ensure both input and output console handles are open */ ! int mode; ! ! a &=3D GENERIC_READ | GENERIC_WRITE; ! if (a =3D=3D GENERIC_READ) ! mode =3D O_RDONLY; ! if (a =3D=3D GENERIC_WRITE) ! mode =3D O_WRONLY; ! if (a =3D=3D (GENERIC_READ | GENERIC_WRITE)) ! mode =3D O_RDWR; ! open (0, mode); /* IGNCR doesn't work yet */ t.c_iflag =3D ICRNL /* | IGNCR */; --=====================_889436946==_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="termcap.diff" *** H-i386-cygwin32/etc/termcap.orig Sun Mar 08 19:26:38 1998 --- H-i386-cygwin32/etc/termcap Sun Mar 08 22:37:38 1998 *************** *** 186,192 **** # # From: Eric S. Raymond 23 July 1995 linux|linux console:\ ! :am:bs:eo:mi:ms:ut:xn:xo:\ :Co#8:co#80:it#8:li#25:pa#64:\ :&7=3D^Z:@7=3D\E[4~:AB=3D\E[4%p1%dm:AF=3D\E[3%p1%dm:\ :AL=3D\E[%dL:DC=3D\E[%dP:DL=3D\E[%dM:F1=3D\E[23~:F2=3D\E[24~:\ --- 186,192 ---- # # From: Eric S. Raymond 23 July 1995 linux|linux console:\ ! :am:bs:eo:hs:mi:ms:ut:xo:\ :Co#8:co#80:it#8:li#25:pa#64:\ :&7=3D^Z:@7=3D\E[4~:AB=3D\E[4%p1%dm:AF=3D\E[3%p1%dm:\ :AL=3D\E[%dL:DC=3D\E[%dP:DL=3D\E[%dM:F1=3D\E[23~:F2=3D\E[24~:\ *************** *** 195,208 **** :S2=3D\E[11m:S3=3D\E[10m:Sb=3D\E[%+(m:Sf=3D\E[%+^^m:\ = = :ac=3D`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~q\304r\362s_t\303= u\264v\301w\302x\263y\371z\372{\373|\374}\375~\376.\031-\030\054\021+^P0\333= :\ :ae=3D\E[10m:al=3D\E[L:as=3D\E[11m:bl=3D^G:cd=3D\E[J:ce=3D\E[K:\ ! :cl=3D\E[H\E[J:cm=3D\E[%i%d;%dH:cr=3D^M:cs=3D\E[%i%d;%dr:\ :ct=3D\E[3g:dc=3D\E[P:dl=3D\E[M:do=3D^J:ei=3D\E[4l:ho=3D\E[H:\ :ic=3D\E[@:im=3D\E[4h:k1=3D\E[[A:k2=3D\E[[B:k3=3D\E[[C:\ :k4=3D\E[[D:k5=3D\E[[E:k6=3D\E[17~:k7=3D\E[18~:k8=3D\E[19~:\ :k9=3D\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h=3D\E[1~:kl=3D\E[D:kr=3D\E[C:\ ! :ku=3D\E[A:le=3D^H:mb=3D\E[5m:md=3D\E[1m:me=3D\E[0;0m:mh=3D\E[9m:mk=3D\E[= 8m:\ ! :mr=3D\E[7m:nd=3D\E[C:nw=3D^M^J:op=3D\E[0;0m:r1=3D\Ec:rc=3D\E8:\ = = :..sa=3D\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7= %t;8%;%?%p8%t;11%;%?%p9%t;11%;m:\ :sc=3D\E7:se=3D\E[m:sf=3D^J:so=3D\E[7m:sr=3D\EM:st=3D\EH:ta=3D^I:\ :u6=3D\E[%d;%dR:u7=3D\E[6n:u8=3D\E[?6c:u9=3D\E[c:ue=3D\E[24m:\ --=====================_889436946==_ Content-Type: text/plain; charset="us-ascii" Larry Hall lhall AT rfk DOT com RFK Partners, Inc. (781) 239-1053 8 Grove Street (781) 239-1655 - FAX Wellesley, MA 02181 http://www.rfk.com --=====================_889436946==_-- - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".