Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Is there a way of getting current xterm buffer?

On Wed, Sep 13, 2023 at 6:01 PM Oliver Kiddle <opk@xxxxxxx> wrote:
> Roman Perepelitsa wrote:
> > xterm does not have this capability and neither do any of the most
> > popular 10 terminals. The only exception among popular terminals is
> > tmux. I don't know of any other terminal with this capability but if
> > it exists it's not a popular one.
> Within limits, it's possible with rxvt-unicode. The escape sequence
> \e[0i is equivalent to pressing Shift-Print_Screen which is for
> sending the scrollback buffer to a printer. To actually capture the
> output you need to send it to a file instead of a printer which is
> configured from .Xresources, e.g. as
>   Rxvt.print-pipe: umask 077;cat >/tmp/XXX
> Same basic concept may work with other terminals but the data is
> being dumped to a file rather than sent down the tty line. So given
> ssh connections or permission changes the zsh completion widget at
> the other end won't be able to read it.
> And I'd agree with Grant that the entire concept is questionable
> from a security perspective. Many terminals removed even the feature
> for retrieving the title bar text.
> Aside from tmux, screen also has the feature with screen -X hardcopy

I stand corrected. Thanks, Oliver.

Now that you mentioned it, I remember `screen hardcopy` but it's news
to me that rxvt-unicode also has something of this sort.



zsh4humans has an option to wrap the TTY in order to implement two
capabilities: save screen and restore screen. The TTY wrapping is
supposed to be transparent but the abstraction is a bit leaky. The
capability to save and restore screen allows one to implement a pop up
window. zsh4humans uses it to display the completion menu above the
prompt line. This in turn allows it to keep prompt at the bottom at
all times without it jumping around. For the sake of consistency,
there is also an option to put prompt at the bottom when zsh is
starting so that it's always in the same location.

Messages sorted by: Reverse Date, Date, Thread, Author