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