Live data from Hacker News

ht: Headless Terminal

github.com

1–10 of 90 posts

Re: ht: Headless Terminal

#3
I think it is a really good idea to separate vt100 emulation "backend" from the UI. Then all terminal emulators could use a common implementation and just focus on displaying the text, instead of emulating quirks of 50-year old devices.

Using JSON as RPC also seems like a good idea, especially when SSH-ing in, as the language server protocol has shown.

That being said, I don't see this project doing anything (yet?) about escape sequences (for colors, clickable links, mouse and clipboard integrations, setting title and cwd, etc) and handling shortcuts (e.g. translating ctrl-c to sigint). There are very few terminal emulators that get all of that right (I think Kitty, iTerm, WezTerm), so it would be great if this project could lead towards more of them being written.

Re: ht: Headless Terminal

#6
post #2

That's pretty interesting. What would be an example use case of this?

I’m guessing it’s mostly useful for writing a terminal emulator in the browser. In theory I think all input and output on the terminal is done via text, which may contain control codes, so you’d still have to write code to render the text, support mouse input and selection, etc.

Re: ht: Headless Terminal

#7
post #2

That's pretty interesting. What would be an example use case of this?

It looks like the use case is if you want to script the usage of a tui program. In most cases it would be best to script the operation yourself with sed rather than ht/nano. I could see this being useful for scripting internal tui tools without access to the source code.

Re: ht: Headless Terminal

#9
First impression: nifty.

Having sat with it a few minutes though, why would I choose this over the classic:

https://core.tcl-lang.org/expect/index

or any of its analogs such as: https://pkg.go.dev/github.com/google/goexpect https://pexpect.readthedocs.io/en/stable/ https://www.rubydoc.info/gems/ruby_expect/1.6.0/RubyExpect/E...

edit: ah. it preserves the UI. This has potential.

Post reply on HN