This is the mail archive of the cygwin-developers@sourceware.cygnus.com mailing list for the Cygwin project. See the Cygwin home page for more information.
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

Re: proposed patch: fix console attribute glitching



On Mon, Mar 22, 1999 at 06:23:16PM -0800, Earnie Boyd wrote:
>---Chris Faylor <cgf@cygnus.com> wrote:
>--8<--
> 
>> 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.
>
>--8<--
>
>I beg to differ with you on this.  The \n moves the cursor to the next
>line, same column.  The \r moves the cursor to the beginning of the
>line.  This is also true in UNIX but the terminal devices handle
>adding the \r to the output to move the cursor to the beginning of the
>line when receiving the \n.  And even this can usually be turned off.

What are you disagreeing with?  The code?  Cygwin sets ENABLE_PROCESSED_OUTPUT
when it opens a console device.  That means that "\n" goes to the beginning
of the next line.

The code that was mentioned above fixes that behavior for the case when
binmode is set.

On UNIX if you have ONLCR set you get similar behavior.

>This also happens currently with cygwin.  To test this, modify the cat
>program to use binary descriptors in all cases.  Try the notty option
>and have a file with just \n endings and one with \r\n endings.  You
>should be able to see the same results with the tty setting if you
>turn off the addition of the \r in bash.

If the cursor moves down a line and stays in the same column then
it's working.  If it doesn't then it is not working.

cgf