4 ms·
wow, this is cool! the quickjs running with syntax highlighting working really caught my eye.
by slondr 4y ago
wow, this is cool! the quickjs running with syntax highlighting working really caught my eye.
- benno128 4y agoThanks! What's super neat here is that I didn't have to build that. The WASI standard defines `fd_fdstat_get` which tells the binary the type of the file descriptor. For stdin/stdout/stderr I return that it is a "Character Device" (https://github.com/taybenlor/runno/blob/main/packages/wasi-motor/lib/wasi/wasi.ts#L484 https://github.com/taybenlor/runno/blob/main/packages/wasi-m...). QuickJS understands that means it's running in a TTY and so it emits all the right characters to do colouring. XTerm.JS then interprets those characters and displays the appropriate colours.