changeset 138:144595e50376

termemu.js: handle some tmux-produced control sequences.
author John "Elwin" Edwards
date Thu, 18 Jul 2013 10:43:41 -0700
parents f14e92f6d955
children dcd07c1d846a
files termemu.js
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/termemu.js	Thu Jul 18 10:36:58 2013 -0700
+++ b/termemu.js	Thu Jul 18 10:43:41 2013 -0700
@@ -1046,6 +1046,10 @@
     }
     else if (c == 109) {
       /* m - character attributes */
+      if (prefix !== null) {
+        debug(1, "Unimplemented CSI sequence: " + comstr);
+        return;
+      }
       if (params.length == 0)
         this.clearAttrs();
       for (var i = 0; i < params.length; i++) {
@@ -1117,8 +1121,8 @@
       else
         break;
     }
-    if (this.comseq[i] != 59) {
-      debug(1, "Invalid OSC sequence");
+    if (i < this.comseq.length && this.comseq[i] != 59) {
+      debug(1, "Invalid OSC sequence: " + this.comseq.toString());
       return;
     }
     var codenum = Number(numstr);
@@ -1165,7 +1169,11 @@
 function dchunk(codes) {
   var dstr = "Chunk: ";
   for (var i = 0; i < codes.length; i++) {
-    if (codes[i] < 32 || (codes[i] >= 127 && codes[i] < 160))
+    if (codes[i] == 27)
+      dstr += "\\e";
+    else if (codes[i] == 92)
+      dstr += "\\\\";
+    else if (codes[i] < 32 || (codes[i] >= 127 && codes[i] < 160))
       dstr += "\\x" + codes[i].toString(16);
     else
       dstr += String.fromCharCode(codes[i]);