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 07:23:45 -0400

On Tue, Mar 12, 2024 at 03:31:44AM -0500, G. Branden Robinson wrote:
> Hi folks,
> 
> I'm working on a revision of the getch(3X) man page and a simple
> experiment has left me stumped.  The attached sample program, as I
> understand the man page, _should_ move the cursor down one row when the
> user types a carriage return.  But, for me, it doesn't.
> 
> Here's the existing man page language:
> 
>      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
>      following rules:
> 
>      •   If the character is the current erase character, left arrow, or
>          backspace, the cursor is moved one space to the left and that
>          screen position is erased as if delch had been called.
> 
>      •   If the character value is any other KEY_ define, the user is
>          alerted with a beep call.
> 
>      •   If the character is a carriage‐return, and if nl is enabled, it
>          is translated to a line‐feed after echoing.
> 
>      •   Otherwise the character is simply output to the screen.
> 
> 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.
> 
> What gives?

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

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

Attachment: nl.c
Description: Text Data

Attachment: signature.asc
Description: PGP signature


reply via email to

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