Re: [dev] a terminal transformer, analogous to a unix filter

From: Rodrigo Martins <rm_AT_firemail.cc>
Date: Fri, 13 Sep 2024 13:51:11 +0000

It was thus said that the Great Greg Reagle once stated:
> I have coined the phrase terminal transformer for a class of programs
> like tmux, dvtm, tcvt, and splitvt. Perhaps there is already a phrase.
> A terminal transformer runs on top of a terminal emulator and acts as
> a terminal emulator itself, with an application like nano running on
> top of it. In other words, it uses a terminal emulator and is used
> as a terminal emulator.
>
> I would like to experiment with a completely transparent transformer as
> a starting point. A transparent transformer passes through everything.
> Ideally it does nothing. Just as a--not useful--example, if I want
> hitting the left cursor key to move the cursor left then right then left
> again, I can add code to intercept that escape sequence and program it
> to do that. That is how I imagine experimenting with more sophisticated
> and useful transformations.
>
> I would like some guidance on developing a program that is a transparent
> terminal transformer in a way that is as simple and stupid as possible.
> Do you have any idea how short or long it would be? What I could look at
> as an example? I am thinking that in order to make it a simple and stupid
> as possible, it runs on top of st and masquerades as st. It uses no
> library like curses or libvte. It deals directly with escape sequences.
> Is such a thing possible or practical? It would be analogous to using
> cat as a filter, and would be as simple as sbase's cat.c (as an ideal, I
> know it does a lot more than cat).
>
> If or when I come up with a useful transformation, I might want to
> make it terminal independent by using curses or libvte, but that is for
> the future.
>
> Can anyone help?
>

Here's a starting point.

It does not know if the child is a terminal or some other program, thus it can be nested. If you think of it as a stack of terminals, each instance deals with two directions of data flow: one going from child to parent, another going from parent to child. You are free to mangle each stream.

Rodrigo.



Received on Fri Sep 13 2024 - 15:51:11 CEST

This archive was generated by hypermail 2.3.0 : Fri Sep 13 2024 - 16:00:09 CEST