bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cbreak+echo+nl: carriage return but no newline


From: Thomas Dickey
Subject: Re: cbreak+echo+nl: carriage return but no newline
Date: Tue, 12 Mar 2024 18:11:40 -0400

On Tue, Mar 12, 2024 at 07:23:45AM -0400, Thomas Dickey wrote:
...
> > 1.  Echo is enabled.
> > 2.  The window is not a pad.
> > 3.  The carriage return "echoes" (the cursor moves to column 0).
> > 4.  The character is not erase, KEY_LEFT, or KEY_BACKSPACE.
> > 5.  The character is not some other KEY_* code.
> > 6.  The character is a carriage return.
> > 7.  "nl" is enabled.
> > 8.  No "translation" (or supplementary) line feed occurs.

getch:
       •   If  the character is a carriage-return, and if nl is enabled, it is
           translated to a line-feed after echoing.

addch:
       •   Carriage return moves the cursor to the window left margin  on  the
           current line.

getch:
       If echo is enabled, and the window is not a  pad,  then  the  character
       will also be echoed into the designated window according to the follow‐
       ing rules:

...that "echoed" should remind the reader that text gets to the screen by
"addch" or something equivalent.  There probably are similar cases in other
manpages...

> > 
> > What gives?
> 
> The test program doesn't show the effect of "translated".
> Here's an updated version which may help clarify that.

(the updated version has a flaw - the getyx should be after getch),
but my followup pointing to addch should be more useful)

either way, the test program returns ^J from getch for me for either key...

-- 
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]