Handle CSI postfix

This commit is contained in:
Daniel Imms
2017-01-09 15:19:29 -08:00
parent 672dc1a251
commit 635a4d7682
+10 -7
View File
@@ -28,6 +28,11 @@ csiStateHandler['6'] = (_, parser) => parser.setParam(parser.getParam() * 10 + 6
csiStateHandler['7'] = (_, parser) => parser.setParam(parser.getParam() * 10 + 7);
csiStateHandler['8'] = (_, parser) => parser.setParam(parser.getParam() * 10 + 8);
csiStateHandler['9'] = (_, parser) => parser.setParam(parser.getParam() * 10 + 9);
csiStateHandler['$'] = (_, parser) => parser.setPostfix('$');
csiStateHandler['"'] = (_, parser) => parser.setPostfix('"');
csiStateHandler[' '] = (_, parser) => parser.setPostfix(' ');
csiStateHandler['\''] = (_, parser) => parser.setPostfix('\'');
// TODO: Add remaining CSI cases
enum ParserState {
NORMAL = 0,
@@ -509,12 +514,6 @@ export class Parser {
break;
}
// '$', '"', ' ', '\''
if (ch === '$' || ch === '"' || ch === ' ' || ch === '\'') {
this._terminal.postfix = ch;
break;
}
this._terminal.params.push(this._terminal.currentParam);
this._terminal.currentParam = 0;
@@ -1047,7 +1046,7 @@ export class Parser {
}
}
public setPrefix(prefix: string) {
public setPrefix(prefix: string): void {
this._terminal.prefix = prefix;
}
@@ -1058,6 +1057,10 @@ export class Parser {
public getParam(): number {
return this._terminal.currentParam;
}
public setPostfix(postfix: string): void {
this._terminal.postfix = postfix;
}
}
const wcwidth = (function(opts) {