bug-ncurses
[Top][All Lists]
Advanced

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

Access to echo, cbreak state without accessing SCREEN internals


From: Bill Gray
Subject: Access to echo, cbreak state without accessing SCREEN internals
Date: Wed, 9 Aug 2023 16:59:31 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

ncurses already has some extension functions to get at internals of (opaque) WINDOW structs. Would you be willing to consider adding these two similar extension functions to get at internals of the SCREEN structure?

int is_cbreak( void);
int is_echo( void);

My use case is as follows : I've written "extended" wgetn_wstr() and wgetnstr() functions that are outside the Curses library, but behave (mostly) the way the standard Curses library functions do, with add-ons such as allowing one to insert/delete in the middle of the text, use the mouse, supply default text, set the field width on-screen, and so on. These functions can then be used with ncurses, PDCurses, or PDCursesMod.

The ncurses (and PDCurses and PDCursesMod) library implementations of those functions save the existing cbreak and echo states, call cbreak() and noecho(), and then restore the original states. Since wgetnstr() and friends are internal Curses functions, having them just access WINDOW and SCREEN structure elements directly is not a problem.

But my functions are _not_ internal to Curses, and shouldn't be accessing SCREEN elements. And, of course, it can't if SCREEN is opaque, as can happen with ncurses and PDCursesMod. So I need functions to tell me if we're in echo and/or cbreak mode.

   I assume that in ncurses,  these extensions would also lead to

int is_cbreak_sp( const SCREEN *sp);
int is_echo_sp( const SCREEN *sp);

There may be other innards to which access would be helpful, but these are the only two I've encountered thus far.

   FWIW,  the code where I need such functions is at

https://github.com/Bill-Gray/find_orb/blob/master/getstrex.cpp#L94

I currently use PDC_getcbreak() and PDC_getecho(), but these are PDCursesMod-only functions.

Thanks!           -- Bill



reply via email to

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