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

[Feature request] WASM Frienly #654

Open
andreytkachenko opened this issue Apr 19, 2022 · 3 comments
Open

[Feature request] WASM Frienly #654

andreytkachenko opened this issue Apr 19, 2022 · 3 comments

Comments

@andreytkachenko
Copy link

May be my question is not addressed correctly, just close issue.
I working on WASI based plugin system. And for terminal applications such as helix I think the best approach would be just compile applications like sidetree to WASM and communicate through stdin/stdout. Most of such programs are based on TUI which is based on crossterm, but inside crossterm there are some ioctl calls (to get terminal size, cursor position and other). Is it possible to add some WASM backend which would communicate through stdin/stdout like SSH, or has some backend trait and make generalized version of crossterm?

@TimonPost
Copy link
Member

TimonPost commented Apr 23, 2022

It could be some feature flag that implements different api for wasm for those particular functions. I am not much in favor of an entire backend abstraction as i'd like to keep this library as minimal as possible.

@LinusU
Copy link

LinusU commented Oct 11, 2022

For wasm32-wasi I think that most things should be provided out-of-the-box, raw mode is probably blocked on WebAssembly/WASI#161 though...

Some imports needs to come from std::os::wasi instead of std::os::unix, e.g. AsRawFd.

@jrvidal
Copy link

jrvidal commented Oct 3, 2024

I've lightly forked crossterm to support a web version of a TUI of mine:[*]

FWIW, the changes that I needed were fairly minimal, just adding a few unimplemented!() "implementations" to get it to compile. The "big" feature that I was missing is a way of getting an EventStream from an arbitrary futures::Stream<Item = Vec<u8>>. I hacked around that by exposing event::sys::unix::parse. Which makes me wonder whether there would be any value into extracting that into a separate crate.

Anyway, sharing just in case it's useful.

[*] Not the first person to do this, see here.

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

4 participants