bug-ncurses
[Top][All Lists]
Advanced

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

Re: calling halfdelay() unmasks ISIG -- is that intentional?


From: Thomas Dickey
Subject: Re: calling halfdelay() unmasks ISIG -- is that intentional?
Date: Wed, 27 Mar 2024 20:27:00 -0400

On Wed, Mar 27, 2024 at 11:39:23AM +0100, Benno Schulenberg wrote:
> 
> Hi Thomas,
> 
> In nano, halfdelay() is used in order to time the dropping of a
> highlight or the wiping of a feedback message.  But after calling
> halfdelay(), the ISIG flag needs to be masked anew for a possible
> ^C to be registered as a keystroke.
> 
> https://git.savannah.gnu.org/cgit/nano.git/tree/src/winio.c?id=f4754bfb5a1f82158aa9119bdaa2cdb8b3bbf627#n214
> 
> In the man page for halfdelay() and friends it says that
> half-delay mode is similar to cbreak mode, and for cbreak
> it says that "interrupt and flow control characters are
> unaffected".  So I would have expected halfdelay() to do
> nothing with ISIG.  Am I reading this wrong?

ah.... both the code and the comment in the manpage are very old.

Eric's code from 1995 ... clears ICANON and then sets ISIG in cbreak,
but nocbreak only sets ICANON.

The manpage was derived from SVr4, which (looking at the illumos code),
correctly described SVr4 (as well as the "xcurses" in Solaris).
The Solaris code does nothing with ISIG for cbreak and nocbreak.

X/Open Curses states for both cbreak and half-delay mode:

        The state of the ISIG and IXON flags are not changed upon
        entering this mode.

So it's a bug (in cbreak).

Changing that in ncurses is likely to be disruptive
(to developers who expect the signals to work).

Also, it'll affect how this is implemented:

20210522
        + modify wgetnstr, wgetn_wstr to improve compatibility with SVr4 curses
          in its treatment of interrupt and quit characters (prompted by
          report/testcase by Bill Gray)

-- 
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]