allow lowercase charset names.

This commit is contained in:
Christopher Jeffrey 2013-07-18 02:10:33 -05:00
parent 90c9484d8b
commit fa2206bb0a
1 changed files with 25 additions and 25 deletions

View File

@ -1346,9 +1346,6 @@ Program.prototype.charset = function(val, level) {
// enter_pc_charset_mode / smpch / S2 // enter_pc_charset_mode / smpch / S2
// exit_pc_charset_mode / rmpch / S3 // exit_pc_charset_mode / rmpch / S3
// tput: TODO
// if (this.tput) return this.put('s' + level, val);
switch (level) { switch (level) {
case 0: case 0:
level = '('; level = '(';
@ -1364,54 +1361,59 @@ Program.prototype.charset = function(val, level) {
break; break;
} }
switch (val) { var name = typeof val === 'string'
case 'SCLD': // DEC Special Character and Line Drawing Set. ? val.toLowerCase()
: val;
switch (name) {
case 'acs':
case 'scld': // DEC Special Character and Line Drawing Set.
if (this.tput) return this.put.smacs(); if (this.tput) return this.put.smacs();
val = '0'; val = '0';
break; break;
case 'UK': // UK case 'uk': // UK
val = 'A'; val = 'A';
break; break;
case 'US': // United States (USASCII). case 'us': // United States (USASCII).
case 'USASCII': case 'usascii':
case 'ASCII': case 'ascii':
if (this.tput) return this.put.rmacs(); if (this.tput) return this.put.rmacs();
val = 'B'; val = 'B';
break; break;
case 'Dutch': // Dutch case 'dutch': // Dutch
val = '4'; val = '4';
break; break;
case 'Finnish': // Finnish case 'finnish': // Finnish
val = 'C'; val = 'C';
val = '5'; val = '5';
break; break;
case 'French': // French case 'french': // French
val = 'R'; val = 'R';
break; break;
case 'FrenchCanadian': // FrenchCanadian case 'frenchcanadian': // FrenchCanadian
val = 'Q'; val = 'Q';
break; break;
case 'German': // German case 'german': // German
val = 'K'; val = 'K';
break; break;
case 'Italian': // Italian case 'italian': // Italian
val = 'Y'; val = 'Y';
break; break;
case 'NorwegianDanish': // NorwegianDanish case 'norwegiandanish': // NorwegianDanish
val = 'E'; val = 'E';
val = '6'; val = '6';
break; break;
case 'Spanish': // Spanish case 'spanish': // Spanish
val = 'Z'; val = 'Z';
break; break;
case 'Swedish': // Swedish case 'swedish': // Swedish
val = 'H'; val = 'H';
val = '7'; val = '7';
break; break;
case 'Swiss': // Swiss case 'swiss': // Swiss
val = '='; val = '=';
break; break;
case 'ISOLatin': // ISOLatin (actually /A) case 'isolatin': // ISOLatin (actually /A)
val = '/A'; val = '/A';
break; break;
default: // Default default: // Default
@ -1426,13 +1428,13 @@ Program.prototype.charset = function(val, level) {
Program.prototype.enter_alt_charset_mode = Program.prototype.enter_alt_charset_mode =
Program.prototype.as = Program.prototype.as =
Program.prototype.smacs = function() { Program.prototype.smacs = function() {
return this.charset('SCLD'); return this.charset('acs');
}; };
Program.prototype.exit_alt_charset_mode = Program.prototype.exit_alt_charset_mode =
Program.prototype.ae = Program.prototype.ae =
Program.prototype.rmacs = function() { Program.prototype.rmacs = function() {
return this.charset('US'); return this.charset('ascii');
}; };
// ESC N // ESC N
@ -1452,8 +1454,6 @@ Program.prototype.rmacs = function() {
// ESC ~ // ESC ~
// Invoke the G1 Character Set as GR (LS1R). // Invoke the G1 Character Set as GR (LS1R).
Program.prototype.setG = function(val) { Program.prototype.setG = function(val) {
// tput: TODO
// if (this.tput) return this.put('s' + val);
// if (this.tput) return this.put.S2(); // if (this.tput) return this.put.S2();
// if (this.tput) return this.put.S3(); // if (this.tput) return this.put.S3();
switch (val) { switch (val) {
@ -1500,7 +1500,7 @@ Program.prototype.setTitle = function(title) {
// OSC Ps ; Pt BEL // OSC Ps ; Pt BEL
// Reset colors // Reset colors
Program.prototype.resetColors = function(param) { Program.prototype.resetColors = function(param) {
if (this.tput.has('Cr')) { if (this.has('Cr')) {
return this.put.Cr(param); return this.put.Cr(param);
} }
return this.osc('112;' + param + '\x07'); return this.osc('112;' + param + '\x07');