]> git.proxmox.com Git - mirror_xterm.js.git/commitdiff
Handle CSI postfix
authorDaniel Imms <daimms@microsoft.com>
Mon, 9 Jan 2017 23:19:29 +0000 (15:19 -0800)
committerDaniel Imms <daimms@microsoft.com>
Mon, 9 Jan 2017 23:19:29 +0000 (15:19 -0800)
src/Parser.ts

index 9e02818d3a3e9a115073e47085689e5b3271fb5f..789688fc523dbaa7da4e21b912939f26daf64593 100644 (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) {