-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
broken escape sequence parser states #145
Comments
You can test this with: expected result:
xterm.js result:
The cursor movement sequence is cancelled and the 'C' is treated as printable. There seems to be another problem since the '\n' doesnt move the cursor to position 1 on the next line (have not investigated this). |
UPDATE: Disregard this, did not see #145 (comment) |
Disregard my previous comment. |
I think I have an example of this affecting a real user... I'm using zsh in xterm.js. On a blank line, I type
When xterm.js renders this, the string at the cursor instantly turns into Seems like broken escape sequence parsing, apologies in advance if it's actually a separate issue. |
@Rodeoclash Are you sending program output directly to the emulator without a pty by any chance? Note that on Unix the newline character is a single '\n' for files, but still gets translated to '\r\n' for terminals by the termios lib in the kernel. |
@jerch Correct. I'm running Webpack via its Node API, capturing the output of a build and sending to an Xterm instance. |
@Rodeoclash You basically lack the pty rewrites which ensure, that the data stream fits into the terminal. Try replacing '\n' with '\r\n'. This will solve the left align issue. If you get problems with lines being to long for the terminal, you'll need to insert additional '\r\n' into a line at the terminal width index. (might not be necessary due to the autowrapping of the emulator) |
Fixed with #1399. |
Please have a look at http://www.vt100.net/emu/dec_ansi_parser. In the state diagram there you can see, that "execute" characters (like '\n', '\r' ...) don't break or reset the actual parser state - they will just get executed for most of the possible states.
Problem is that some sequence parser states allow nesting other escape sequences while others dont. That is not reflected by the actual state handling in xterm.js
This is partly tested by vttest under "1. Test of cursor movements" (press 5 times 'enter')
IMHO this is a major issue, since it affects the flow/state logic in
write
which is kinda the terminal core.The text was updated successfully, but these errors were encountered: