proposed patch: fix console attribute glitching

Chris Faylor
Mon Mar 22 17:09:00 GMT 1999

On Mon, Mar 22, 1999 at 04:43:49PM -0800, Keith Reynolds wrote:
>The old code contained the lines:
>	if (get_w_binary())
>	  cursorl_rel (x, 0);
>This undoes the fact that writing a newline with WriteFile()
>outputs a CR also.  What I don't know is whether the code is like
>this because (a) WriteFile doesn't add a CR if get_w_binary() is
>false, or (b) the CR should be there if get_w_binary() is false.

An output of "\n" cause the cursor to be moved to the beginning of
the next line.  For binary output this is not right.  The above code
moves the cursor to just below its previous position.

>If the latter is true, then the cursor_rel call in the new code
>should be changed to (something like):
>	if (get_w_binary())
>	  cursor_set (FALSE, 0, y+1);
>	else
>	  cursor_rel (0, 1);

This doesn't scroll the screen, as you note below:

>The second thing I didn't understand was why the test.
>	if (y == srBottom && y < info.winBottom)

If you're at the bottom of the scrolling region and you're not
already at the bottom of the screen, then scroll the scrolling

I think your change makes this:
If you're at the bottom of the scrolling region or you're at the
bottom of the screen, then scroll the scrolling region.

This isn't right.

Probably all that you need to do is make sure that srBottom is
set correctly.  You could set the scroll region in fillin_info
rather than in scroll_screen, i.e., move this code:

  if (scroll_region.Bottom < 0)
    scroll_region.Bottom = info.dwWinSize.Y - 1;

to fillin_info.

>The last two diffs below are a feature request: on various UNIX
>flavours I use, control-6 maps to ^^, which is ASCII value 30.
>Vi/vim map this to "switch to the previous file", which I use all
>the time and have sorely missed when using cygwin.  This change
>adds that keystroke.  It also maps control-F6 to the same thing,
>which is the "switch window" command in Word and other Windows
>apps, which (God help me) I've also gotten used to using.  Again,
>this change has been working for me for a week or so.

I don't see anything wrong with those two changes.

If you'll resubmit this patch with the above suggestions, I'll
apply it.  It will be nice not to see the highlighting glitches.
I only notice them in Window 95 but...


More information about the Cygwin-developers mailing list