[Semi-WIP] Rewrite terminal based on xterm.js; redirecting stdin, using dash #65
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#16
This code works, but there are a couple awkward details.
Advantages over previous implementation
cat
and see it redirect stdin to stdout (but not to close it, since ctrl-c and ctrl-d are not implemented)Disadvantages from previous implementation
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.