xterm-pty

A bridge that connects xterm.js and an Emscripten'ed CUI program

Demo

This VIM editor is compiled by Emscripten, and runs with xterm.js. We have confirmed that it works with Google Chrome 98 and Firefox 97.

Loading status: Not loaded

Write anything and save it as "/home/web_user/test.txt" by :w ~/test.txt.

    What's xterm-pty?

    In a nutshell, xterm-pty is an addon that adds a PTY layer to xterm.js.

    A PTY, or pseudoterminal, is an intermediate layer between a process and a terminal. It is not just a pipe, but provides several useful functionalities such as input echo, line editing, conversion, etc. PTY is essential for running real-world CUI programs.

    Usually, xterm.js is used with node-pty. Because node-pty is a binding for the PTY functions provided by the operating system, it does not work on a browser. On the other hand, xterm-pty works on a browser because it has an own implementation of simple Linux-like line discipline.

    A typical use case for this addon is to run a CUI program built by Emscripten with xterm.js. See mame/xterm-pty for how to use it.

    Note: This VIM is just a demo of xterm-pty. If you are interested in a practical WebAssembly port of VIM, you may want to check rhysd/vim.wasm, which implements their own GUI frontend instead of using xterm.js.

    Other Asyncify examples

    example.c

    Loading status: Not loaded

    PThread proxying examples

    The following two examples uses "PThread proxying", which requires SharedArrayBuffer. They may not work in some environments.

    SL(1): Cure your bad habit of mistyping

    Loading status: Not loaded

    sloane.c: IOCCC 2006 Homer's Favorite

    document

    Loading status: Not loaded