comparison termemu.js @ 138:144595e50376

termemu.js: handle some tmux-produced control sequences.
author John "Elwin" Edwards
date Thu, 18 Jul 2013 10:43:41 -0700
parents a4d3ecf188b7
children 6758d832c10c
comparison
equal deleted inserted replaced
137:f14e92f6d955 138:144595e50376
1044 } 1044 }
1045 } 1045 }
1046 } 1046 }
1047 else if (c == 109) { 1047 else if (c == 109) {
1048 /* m - character attributes */ 1048 /* m - character attributes */
1049 if (prefix !== null) {
1050 debug(1, "Unimplemented CSI sequence: " + comstr);
1051 return;
1052 }
1049 if (params.length == 0) 1053 if (params.length == 0)
1050 this.clearAttrs(); 1054 this.clearAttrs();
1051 for (var i = 0; i < params.length; i++) { 1055 for (var i = 0; i < params.length; i++) {
1052 if (params[i] == null || params[i] == 0) 1056 if (params[i] == null || params[i] == 0)
1053 this.clearAttrs(); 1057 this.clearAttrs();
1115 if (this.comseq[i] >= 48 && this.comseq[i] <= 57) 1119 if (this.comseq[i] >= 48 && this.comseq[i] <= 57)
1116 numstr += String.fromCharCode(this.comseq[i]); 1120 numstr += String.fromCharCode(this.comseq[i]);
1117 else 1121 else
1118 break; 1122 break;
1119 } 1123 }
1120 if (this.comseq[i] != 59) { 1124 if (i < this.comseq.length && this.comseq[i] != 59) {
1121 debug(1, "Invalid OSC sequence"); 1125 debug(1, "Invalid OSC sequence: " + this.comseq.toString());
1122 return; 1126 return;
1123 } 1127 }
1124 var codenum = Number(numstr); 1128 var codenum = Number(numstr);
1125 var msgstr = ""; 1129 var msgstr = "";
1126 i++; 1130 i++;
1163 }; 1167 };
1164 1168
1165 function dchunk(codes) { 1169 function dchunk(codes) {
1166 var dstr = "Chunk: "; 1170 var dstr = "Chunk: ";
1167 for (var i = 0; i < codes.length; i++) { 1171 for (var i = 0; i < codes.length; i++) {
1168 if (codes[i] < 32 || (codes[i] >= 127 && codes[i] < 160)) 1172 if (codes[i] == 27)
1173 dstr += "\\e";
1174 else if (codes[i] == 92)
1175 dstr += "\\\\";
1176 else if (codes[i] < 32 || (codes[i] >= 127 && codes[i] < 160))
1169 dstr += "\\x" + codes[i].toString(16); 1177 dstr += "\\x" + codes[i].toString(16);
1170 else 1178 else
1171 dstr += String.fromCharCode(codes[i]); 1179 dstr += String.fromCharCode(codes[i]);
1172 } 1180 }
1173 debug(1, dstr); 1181 debug(1, dstr);