Open linkerlin opened 3 months ago
Could be a nice project for you, don't you think?
@linkerlin @rivo Technically tview already runs in WASM/webassembly.
tview is not what needs to support it since it is just a UI framework.
The gdamore/tcell supports WASM, and since it is what tview uses to render/interact with the vt/tty/pty, you just need to implement a more controlled handling of how tview uses the Screen
.
A app.SetScreen
is usually enough to make it work when passing the Webview's screen.
However, AFAIK the current WASM support for gdamore/tcell simply draws to a CANVAS, and I do not know how it handles resizing/paste/mouse interactions. You can read more in their issues about this.
However, because I wanted to be able to support xterm.js
and all it's nice tty/pty emulation works (opengl,canvas,html) rendering options, and support for all those things I mentioned, I created my own xterm.js
addon to support tcell/tview
It is in nowhere near anything production/polished, but it works well already.
I wouldn't mind posting it's current state, but I do not have the time to finish/assist beyond just pushing the source (it's not doc'd well). However to anyone capable it is a starting point that just needs optimization, and better organization/docs.
It requires an xterm.js addon in JS and changes to tcell that do not affect existing operations.
I don't mind releasing what I have if someone wants to take it over or use it as a basis/insight to build/learn from.
However if I do, it would be privately released and collaborators added. I am embarassed at how badly messed up the code is, since I whipped this up as quick as possible to meet a deadline after realizing that xterm.js didnt support what I wanted to do and had to make it work whether or not anyone else could read the code.
Also the fact that I have the worst/vulgar/stupid test strings/var names/comment handling, doesn't help as you will see below.
https://github.com/rivo/tview/assets/1828125/ee117fd9-908f-432d-a60f-220a5912a3d6
It would be really cool if the tview project could run in a browser just like gio!