Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

running on browsers ? (webassembly?) #956

Open
linkerlin opened this issue Mar 9, 2024 · 2 comments
Open

running on browsers ? (webassembly?) #956

linkerlin opened this issue Mar 9, 2024 · 2 comments

Comments

@linkerlin
Copy link

It would be really cool if the tview project could run in a browser just like gio!

@rivo
Copy link
Owner

rivo commented Mar 9, 2024

Could be a nice project for you, don't you think?

@digitallyserviced
Copy link
Contributor

@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.

291585755-781d588b-e439-4e21-bc11-359335d1a134.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants