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: Gabriel Ravier
Subject: Re: cbreak+echo+nl: carriage return but no newline
Date: Wed, 13 Mar 2024 01:23:57 +0000
User-agent: Mozilla Thunderbird

On 3/12/24 23:25, G. Branden Robinson wrote:
Hi Thomas,

At 2024-03-12T18:47:57-0400, Thomas Dickey wrote:
On Tue, Mar 12, 2024 at 05:38:03PM -0500, G. Branden Robinson wrote:
So all nl() and nonl() do is convert the keycode reported by wgetch()?
[...]
What is this feature _for_?
the reasoning is lost in the mists of committee meetings thirty-some
years ago
The great thing about meeting minutes is how easily they're misplaced...


Looking at the original documentation for curses from way back in 1980, i.e. Kenneth C. R. C. Arnold's Screen Updating and Cursor Movement Optimization: A Library Package paper (I'm pretty sure this is long before committee meetings were involved) states that:

- nl() and nonl() control what the documentation calls "newline mapping"

- when newline mapping is on and waddch() is passed a newline ('\n') as an input character, the line is cleared to the end and the y/x coordinates are changed to the beginning of the next line - whereas if newline mapping is off the y/x coordinates are changed to the next line but at the same x coordinate.

- raw() and noraw() also respectively turn off and on newline mapping but "only on Version 7 UNIX" (though 4BSD appears to also have this behavior - likely the paper predatesk 4BSD and that's why this is not mentioned)

- If newline mapping is not done, refresh() can "do more optimization" and thus "it is recommanded" to turn it off (this is also restated in an example program which has a comment on a call to nonl() stating "for optimization")


So it seems to be largely for optimization - the documentation doesn't mention any other reasons why someone would want to use it (I guess "some people might just want newline mapping in general" is implied). I will also add that in 4BSD those functions do in fact change the terminal mode, as mentioned before, using stty to unset CRMOD - w.r.t. how this optimizes anything I'm not exactly clear on, and BSD developers that came after the original creation of curses seem to agree with that sentiment as well since BSD SCCS checkins on libcurses contain such quotes as "We still aren't sure what pfast is for, but we haven't given up yet" (in BSD's libcurses pfast is FALSE when newline mapping is on and TRUE when it is off)


[...]
Regards,
Branden



reply via email to

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