delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/10/07/06:48:29

From: lhall AT rfk DOT com (Larry Hall)
Subject: Re: color problem when not using bash
7 Oct 1998 06:48:29 -0700 :
Message-ID: <3.0.5.32.19981007092324.00a3f100.cygnus.cygwin32.developers@pop.ma.ultranet.com>
References: <361B37EF DOT 194BDE3A AT cityweb DOT de>
Mime-Version: 1.0
To: Corinna Vinschen <corinna DOT vinschen AT cityweb DOT de>,
cygwin32-developers AT cygnus DOT com

At 11:44 AM 10/7/98 +0200, Corinna Vinschen wrote:
>Hi,
>
>I have already spoken about the problem, but it's not
>removed.
>
>I'm using tcsh 6.07.02 as shell and it's compiled without any
>special CYGWIN code. The effect is since winsup-980914.
>
>Imagine the follow:
>
>The factory default colors of the Win console window are grey
>font on black background. Let's name it FC (factory color).
>
>I now change it to, say sth., black font on light yellow ground.
>Name it OC (own color).
>
>CYGWIN32=binmode ntea notty
>so `tty' gives: /dev/conin.
>
>Now starting tcsh.
>
>-> All screen has OC.
>
>Hitting `X' and then backspace.
>
>-> Right of the cursor now is FC.
>
>Starting `vi'.
>
>-> The text is OC, all blanks (esp. at the right of the text) are FC.
>
>Starting `clear'.
>
>-> All screen is FC.
>
>While trying to find the problem in fhandler_console.cc, I have
>only figured out, the the method fhandler_console::fillin_info()
>is also called in constructor. This is definitely unnecessery,
>because at this time, output_handle_ is NULL. But the real
>solution??? Sigh!
>
>Another problem is, that, while correcting the input line,
>if one moves the cursor to the left, and then inserts chars,
>the rest of the line is not be moved to the right. This
>also happens in mode CYGWIN32='... tty ...'.
>But if you change TERM to 'ansi',  this effect never
>occures again.
>
>Corinna
>
>The diff, to avoid unnecessary calls to fillin_info():
>---- snip ----
>*** fhandler_console.cc.orig    Wed Oct 07 10:12:11 1998
>--- fhandler_console.cc Wed Oct 07 10:14:45 1998
>*************** fhandler_console::fhandler_console (cons
>*** 406,415 ****
>    set_cb (sizeof *this);
>    iflag_ = lflag_ = nargs_ = 0;
>    state_ = normal;
>!   if (fillin_info ())
>!     default_color = info.wAttributes;
>!   else
>!     default_color = FOREGROUND_BLUE | FOREGROUND_GREEN |
>FOREGROUND_RED;
>  }
>
>  /*
>--- 406,412 ----
>    set_cb (sizeof *this);
>    iflag_ = lflag_ = nargs_ = 0;
>    state_ = normal;
>!   default_color = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED;
>  }
>
>  /*
>

If you are right about the call to fillin_info(), then I would suggest
removing the line to set the default_color completely.  It would just be
misleading and also unnecessary then.  However, you should be sure this is 
the case since, if its not, your change will change the user's foreground 
color to white, regardless of what its been set to by the user.  This may
not be an obvious problem on 9x, where the DOS box has no way to alter the
default colors but it is an issue on NT (or perhaps with 4DOS either place.)
I made this change in an effort to maintain the user's settings when working
with Cygwin console applications (native, that is) and I know they worked to
the extent I tested them (worked on NT and didn't cause obvious problems on
95, although there was limited testing there.)  That said, I did not step 
through every change in the debugger to make sure that all of them were
necessary.  I merely used the preexisting code as a guide to where I should
change things.  As a result, it is possible that the call to fillin_info()
in the constructor is unnecessary.  But, as I said, if this is really the 
case, then any setting for default_color is too.  

I won't say that there aren't still color problems for consoles, 
particularly in relation to non-cygwin apps running in bash or cygwin apps
running in the command/cmd prompt.  I also have not tried to use tcsh at
all with my changes so there may be additional issues there as well.  Still,
the changes I made were a BIG help to me and yours are the first issues 
I've heard in this regard so far so I think the changes I made are a step 
in the right direction at least.  Although I've been using these changes
myself for about 9 months, they've only be part of the Cygnus sources since
the beginning of June though...

Hope that helps some.



Larry Hall                              lhall AT rfk DOT com
RFK Partners, Inc.                      (781) 239-1053
8 Grove Street                          (781) 239-1655 - FAX
Wellesley, MA  02482-7797               http://www.rfk.com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019