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 bug with parser state when using vtop #672

Merged
merged 1 commit into from May 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Parser.ts
Expand Up @@ -181,7 +181,7 @@ export class Parser {
*
* @param data The data to parse.
*/
public parse(data: string) {
public parse(data: string): ParserState {
let l = data.length, j, cs, ch, code, low;

this._position = 0;
Expand Down Expand Up @@ -564,6 +564,7 @@ export class Parser {
break;
}
}
return this._state;
}

/**
Expand Down
8 changes: 7 additions & 1 deletion src/xterm.js
Expand Up @@ -1252,7 +1252,13 @@ Terminal.prototype.innerWrite = function() {
this.refreshStart = this.y;
this.refreshEnd = this.y;

this.parser.parse(data);
// HACK: Set the parser state based on it's state at the time of return.
// This works around the bug #662 which saw the parser state reset in the
// middle of parsing escape sequence in two chunks. For some reason the
// state of the parser resets to 0 after exiting parser.parse. This change
// just sets the state back based on the correct return statement.
var state = this.parser.parse(data);
this.parser.setState(state);

this.updateRange(this.y);
this.refresh(this.refreshStart, this.refreshEnd);
Expand Down