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

[Semi-WIP] Rewrite terminal based on xterm.js; redirecting stdin, using dash #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ids1024
Copy link

@ids1024 ids1024 commented Apr 22, 2019

#16

This code works, but there are a couple awkward details.

browsix-xtermjs

Advantages over previous implementation

  • Runs an actual shell, dash, providing working directories, variables, and all other standard POSIX shell features
  • Supports input redirection. For instance, it is possible to call cat and see it redirect stdin to stdout (but not to close it, since ctrl-c and ctrl-d are not implemented)
  • xterm.js supports a large range of console features, such as color, which I tested; and probably too many other things for me to be able to name.

Disadvantages from previous implementation

  • Annoyingly, no prompt is displayed. Dash only displays a prompt when connected to a tty

Other notes

I made some awkward changes in gulpfile.js to copy the xterm.js library from npm, since it doesn't support bower. I think the bobby/modern-build branch is getting rid of bower? In which case, I (or someone else) can update this once that code is merged.

A fully functional terminal will require some form of pty implementation. There seems to be some initial code for that in the _term3 branch, but that appears to have never been finished.

The line editing code I implemented here isn't strictly correct. In an actual terminal, it seems the left and right arrow keys don't seem to do anything (other than print garbage). Shells like bash (but not dash, it seems) set the tty to non-canonical mode and implement that themselves. So this should probably be removed at some point, but is nice to have until the proper solution is available.

It seems best for me to share this code. I might look into ptys at some point.

@tcoulter
Copy link

Hey @ids1024, you seem like you know what you're doing. I'm just getting started with browsix. Do you think you can answer #69 for me?

As background, I'm looking exactly the browsix kernel with an xterm frontend, with one extra command line tool added. What you've built is perfect, and I'd ultimately love to figure out how to contribute.

Thanks in advance!

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

Successfully merging this pull request may close these issues.

None yet

2 participants