Exploring terminfo

Grant Edwards grant.b.edwards at gmail.com
Thu Jan 14 17:11:43 EST 2021


On 2021-01-14, Barry Scott <barry at barrys-emacs.org> wrote:

> It seems that curses does not allow you to mix raw stdin/stdout with
> its calls.  (got that idea from a quick web search).

That is definitely the case. Output in curses is done to an in-memory
virtual terminal screen. Optimized output is then sent (at some point
later) to update the physical terminal with any changes made in the
virtual terminal since the last update.  If you want to use ncurses,
you can't mess with the physical terminal behind its back and expect
anything to work.

> If all you want is simple things like bold and clear I'd just use the
> ANSI escape sequences directly.

Or use a terminfo library:

  https://github.com/DirectXMan12/py-terminfo

It _may_ be possible to use ncurses to get the terminfo strings
required for various functions without actually having ncurses to any
I/O, but I've never tried that...

--
Grant



More information about the Python-list mailing list