Add isNixTerm(), use includes vs indexOf on array search

This commit is contained in:
Bryan Ashby 2017-09-24 11:15:26 -06:00
parent 1784afffa7
commit 47551b1803
1 changed files with 12 additions and 1 deletions

View File

@ -110,6 +110,17 @@ ClientTerminal.prototype.disconnect = function() {
this.output = null; this.output = null;
}; };
ClientTerminal.prototype.isNixTerm = function() {
//
// Standard *nix type terminals
//
if(this.termType.startsWith('xterm')) {
return true;
}
return [ 'xterm', 'linux', 'screen', 'dumb', 'rxvt', 'konsole', 'gnome', 'x11 terminal emulator' ].includes(this.termType);
};
ClientTerminal.prototype.isANSI = function() { ClientTerminal.prototype.isANSI = function() {
// //
// ANSI terminals should be encoded to CP437 // ANSI terminals should be encoded to CP437
@ -142,7 +153,7 @@ ClientTerminal.prototype.isANSI = function() {
// linux: // linux:
// * JuiceSSH (note: TERM=linux also) // * JuiceSSH (note: TERM=linux also)
// //
return [ 'ansi', 'pcansi', 'pc-ansi', 'ansi-bbs', 'qansi', 'scoansi', 'syncterm' ].indexOf(this.termType) > -1; return [ 'ansi', 'pcansi', 'pc-ansi', 'ansi-bbs', 'qansi', 'scoansi', 'syncterm' ].includes(this.termType);
}; };
// :TODO: probably need to update these to convert IAC (0xff) -> IACIAC (escape it) // :TODO: probably need to update these to convert IAC (0xff) -> IACIAC (escape it)