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

Fix many vt tests #500

Merged
merged 13 commits into from Jan 26, 2017
Merged

Fix many vt tests #500

merged 13 commits into from Jan 26, 2017

Conversation

Tyriar
Copy link
Member

@Tyriar Tyriar commented Jan 21, 2017

This PR fixes many of the tests in escape-sequence-tests.js, see the commits for details on the individual changes. Previously 10 tests were passing, now 30+ are.

The major fixes:

  • CAN has been implemented which cancels any escape sequence, the corresponding test does not work still due to complex ignore logic in xterm that we don't have parity with
  • Index, LF/VT/FF, CUB, CUD, VPR behavior was change to stay at the end of the column if it was otherwise going to go to wraparound
  • When wraparound mode is disabled output will be cut off the end, no longer will the last character always be displayed in the last column
  • There was an error which cause causing our tests to compare only the first page of the buffer, not the viewport.
  • Expected output was trimmed as we don't care, at least not currently (we trim all output from xterm.js anyway).

There is a failing test:

1) xterm.js unicode - surrogates 2 characters per cell over line end without autowrap:

      AssertionError: expected 'a' to deeply equal '𐀀'
      + expected - actual

      -a
      +𐀀

This is likely because it relied on the previous wraparound disabled logic which I believe was wrong. @jerch thoughts since you added it?

Don't wrap cursor to column 0 after an index, fixes 2 tests
Don't wrap cursor to column 0 after an index, fixes 2 tests
This helps partially pass t0014-CAN.in, it won't work 100% however
due to the very complex parsing logic of vanilla xterm that
gnome-terminal doesn't even seem to match. xterm's source seems to
have multiple ignore cases for a set of characters such that an
escape sequence like \e!!!!!! prints nothing as the ! continually
gets ignored. Our current logic is we ignore the escape sequence
immediately in this case and print the !.
Don't wrap cursor to column 0 after a CUB, fixes 3 tests
Don't wrap cursor to column 0 after a CUD, fixes 1 test
Don't wrap cursor to column 0 after a VPR, fixes 1 test
@Tyriar Tyriar self-assigned this Jan 21, 2017
@Tyriar Tyriar requested a review from parisk January 21, 2017 08:11
Copy link
Contributor

@parisk parisk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some documentation requests and after fixing the test we are 👍 .

@@ -124,6 +123,9 @@ export class InputHandler implements IInputHandler {
this._terminal.y--;
this._terminal.scroll();
}
if (this._terminal.x >= this._terminal.cols) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the role of these lines here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a line comment please?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like you are shifting things up when you are inserting a line feed, when you are in the bottom line?

@@ -218,6 +220,9 @@ export class InputHandler implements IInputHandler {
if (this._terminal.y >= this._terminal.rows) {
this._terminal.y = this._terminal.rows - 1;
}
if (this._terminal.x >= this._terminal.cols) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a line comment of what this if clause does please? Seems identical to https://github.com/sourcelair/xterm.js/pull/500/files#r97194377.

@@ -244,6 +249,9 @@ export class InputHandler implements IInputHandler {
if (param < 1) {
param = 1;
}
if (this._terminal.x >= this._terminal.cols) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a line comment of what this if clause does please? Seems identical to https://github.com/sourcelair/xterm.js/pull/500/files#r97194377.

@@ -693,6 +701,9 @@ export class InputHandler implements IInputHandler {
if (this._terminal.y >= this._terminal.rows) {
this._terminal.y = this._terminal.rows - 1;
}
if (this._terminal.x >= this._terminal.cols) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a line comment of what this if clause does please? Seems identical to https://github.com/sourcelair/xterm.js/pull/500/files#r97194377.

@@ -2303,6 +2303,9 @@ Terminal.prototype.index = function() {
this.y--;
this.scroll();
}
if (this.x >= this.cols) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a line comment of what this if clause does please? Seems identical to https://github.com/sourcelair/xterm.js/pull/500/files#r97194377.

@parisk
Copy link
Contributor

parisk commented Jan 21, 2017

This is the test case failing: https://github.com/sourcelair/xterm.js/blob/4d5046b5e7047bfcf1f1dba088acb343df1969bb/src/test/test.js#L598

Not sure which of these three expects fail. I think that you can just uncomment all your changes in inputhandler, parser and xterm and then by putting one piece at a time back in you will be able to find what broke this test.

@parisk
Copy link
Contributor

parisk commented Jan 21, 2017

Any way I can help?

@Tyriar
Copy link
Member Author

Tyriar commented Jan 21, 2017

It's the first expect and I think it's to do with Tyriar@43c3349

I believe it's verifying the wrong behavior.

@jerch
Copy link
Member

jerch commented Jan 21, 2017

@Tyriar Yeah the test checks that with wraparoundMode = false surrogate chars correctly end up the last cell. Since you changed that behavior to truncating the line, the test is not applicable anymore.
(Btw truncating the line is not conform to the old VTs, they were not able to move the cursor beyond the display, thats why they simply inserted the char at the last cell)

@Tyriar
Copy link
Member Author

Tyriar commented Jan 21, 2017

@jerch thanks for the clarification, I'll pull the test out 😄

@Tyriar
Copy link
Member Author

Tyriar commented Jan 25, 2017

@parisk good to look at again

Copy link
Contributor

@parisk parisk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@Tyriar Tyriar merged commit d1ad8a7 into xtermjs:master Jan 26, 2017
@Tyriar Tyriar deleted the fix_vt_tests branch January 26, 2017 16:55
@Tyriar Tyriar modified the milestone: 2.3.0 Feb 2, 2017
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

3 participants