Remix.run Logo
Rendering complex scripts in terminal and OSC 66(thottingal.in)
30 points by sthottingal 4 days ago | 7 comments
Joker_vD 3 hours ago | parent | next [-]

> The real fix requires agreement at the protocol level, across terminal emulators, shell applications, and TUI frameworks simultaneously.

Yeah, and ideally you want the backward compatibility, so we don't have to recompile the world or patch things like e.g. cat.

But yeah, the root of the problem is that a) the TUI-like application that manually drives the terminal, with cursor movement/line folding/redrawing etc. needs to know, at every single moment, the precise location of the cursor and the coordinates of every single character it outputted (to e.g. properly handle backspacing, including over the line folds: \b explicitly doesn't move to the previous line by default and very wide and old convention), and b) getting that coordination info from the terminal in quick, reliable, and side-effect free manner is impossible, so you have to guess.

skissane 39 minutes ago | parent [-]

I think we really need a new protocol for apps to use when interacting with terminals, which is richer than sending escape sequences.

It could just be the path to a Unix domain socket in an environment variable, where that socket speaks some kind of RPC protocol

Affric 5 hours ago | parent | prev | next [-]

How often are complex scripts rendered in terminal? What is the cost to scripts that are currently rendered accurately by terminal? Are there any group of tools that operate in complex scripts?

EDIT: Without saying that I think this is worthy and cool. I am just curious about the costs and benefits of such a tool.

Joker_vD 3 hours ago | parent | next [-]

> How often are complex scripts rendered in terminal?

If you speak the languages that use those scripts? Then all the time, I imagine. The support for double-char width cells in the terminals started to appear all the way back in the late seventies because Japan, you know, existed and kinda mattered.

genC_old_one 3 hours ago | parent | prev [-]

[dead]

skydhash 4 hours ago | parent | prev | next [-]

The issue is handled both by Emacs and Acme by eschewing the terminal. Instead they use the shell (and direct command execution) for commands. So that means no terminfo/termcap, ncurses, and escape codes (but Emacs have a library to parse some ansi codes).

faangguyindia 8 hours ago | parent | prev [-]

I used Rich library in python. And it was recommended to me by claude as top tui library in python space.

It can't handle terminal window resize and the layout gets messed up

I was surprised to see node based cli work much better with resize?

Anyone knows why?