bug-ncurses
[Top][All Lists]
Advanced

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

Re: pty-in-a-tty ("picture in a picture")


From: Bryan Christ
Subject: Re: pty-in-a-tty ("picture in a picture")
Date: Sat, 14 Nov 2020 16:07:29 -0600

Libvterm is specifically is designed to do this.

https://github.com/TragicWarrior/libvterm


On Sat, Nov 14, 2020, 14:47 Nick Black <dankamongmen@gmail.com> wrote:
Apologies for what is not an NCURSES question proper, but this
list has proven the best place to find relevant thinkers.

I am the primary author of another TUI/cellgraphics library[0],
and have recently been considering what would be necessary to
display one terminal application's output as a subset of
another's[1]. The particular case that drove this line of inquiry
was the desire for a TUI realtime profiler (based around the
Linux `perf` tool), and how it would best support programs which
themselves make use of libraries such as NCURSES.

I already have a widget that facilitates reproducing the output
of a subprocess using standard I/O within a distinct rectilinear
subset of the screen (roughly a PANEL in NCURSES parlance)[2]. I
wish to generalize this to programs making use of terminfo.

It seems to me that optimized cursor routines fundamentally
cannot work symbiotically without some manner of orchestration,
as they'd step all over one another. Fair enough. The logical
next step in my mind, then, is for the parent process to open
the master end of a pty, and spawn the child process attached to
that pty. Processes honoring environment variables such as
LINES/COLUMNS could then be restricted to a small region; that
virtual region could then be reproduced wherever the parent
process wished on its own terminal.

To properly support terminfo-based (including NCURSES-based)
programs, it seems then that I would need supply a terminfo
entry for my library, and declare a TERM environment variable
corresponding to said entry (the contents of such an entry,
given the uncertainty regarding my main process's terminal, is
another interesting question). I would then translate and adjust
the child process's escapes into those proper for the real
terminal, just (presumably) as `screen` and friends do (indeed,
this is in ways simply a programmatic `screen`).

What wisdom/suggestions/animadversions would people offer? To
what degree is this a fool's errand? What ought I be careful to
do or not do? What codes and texts are recommended for study?

Thank you for your time and advice!

--studiously, nick

[0] https://notcurses.com/
[1] https://github.com/dankamongmen/notcurses/issues/487
[2] https://github.com/dankamongmen/notcurses/blob/master/src/lib/fd.c

--
nick black -=- https://www.nick-black.com
to make an apple pie from scratch,
you need first invent a universe.

reply via email to

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