Handle more pseudoÃ-graphic characters and ways of using them. This gets aptitude (from debianÃ) displaying properly and should also fix midnight commander.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38139 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues
2010-08-16 13:11:51 +00:00
parent 397fd7f5d0
commit 3eedbbbf0e
2 changed files with 64 additions and 10 deletions
+58 -4
View File
@@ -330,6 +330,10 @@ TermParse::EscParse()
int *groundtable = gUTF8GroundTable;
int *parsestate = gUTF8GroundTable;
/* Handle switch between G0 and G1 character sets */
int *alternateParseTable = gUTF8GroundTable;
bool shifted_in = false;
int32 srcLen;
int32 dstLen;
long dummyState = 0;
@@ -453,6 +457,9 @@ TermParse::EscParse()
case CASE_PRINT_GRA:
/* "Special characters and line drawing" enabled by \E(0 */
switch (c) {
case 'a':
fBuffer->InsertChar("\xE2\x96\x92",3,fAttr);
break;
case 'j':
fBuffer->InsertChar("\xE2\x94\x98",3,fAttr);
break;
@@ -465,9 +472,26 @@ TermParse::EscParse()
case 'm':
fBuffer->InsertChar("\xE2\x94\x94",3,fAttr);
break;
case 'n':
fBuffer->InsertChar("\xE2\x94\xBC",3,fAttr);
break;
case 'q':
fBuffer->InsertChar("\xE2\x94\x80",3,fAttr);
break;
case 't':
fBuffer->InsertChar("\xE2\x94\x9C",3,fAttr);
break;
case 'u':
fBuffer->InsertChar("\xE2\x94\xA4",3,fAttr);
break;
case 'v':
fBuffer->InsertChar("\xE2\x94\xB4",3,fAttr);
break;
case 'w':
fBuffer->InsertChar("\xE2\x94\xAC",3,fAttr);
break;
case 'x':
fBuffer->InsertChar("\xE2\x94\x82",3,fAttr);
break;
default:
fBuffer->InsertChar((char)c, fAttr);
@@ -542,11 +566,29 @@ TermParse::EscParse()
break;
case CASE_SCS_STATE:
if (_NextParseChar() == '0')
parsestate = gLineDrawTable;
else
parsestate = groundtable;
{
char page = _NextParseChar();
int* newTable = gUTF8GroundTable;
if (page == '0')
newTable = gLineDrawTable;
if (c == '(') {
if (shifted_in)
alternateParseTable = newTable;
else
groundtable = newTable;
} else if (c == ')') {
if (!shifted_in)
alternateParseTable = newTable;
else
groundtable = newTable;
}
parsestate = groundtable;
break;
}
case CASE_GROUND_STATE:
/* exit ignore mode */
@@ -585,9 +627,21 @@ TermParse::EscParse()
break;
case CASE_SI:
/* shift in (to G1 charset) */
if (shifted_in == false) {
int* tmp = alternateParseTable;
alternateParseTable = parsestate;
parsestate = tmp;
}
break;
case CASE_SO:
/* shift out (to G0 charset) */
if (shifted_in == true) {
int* tmp = alternateParseTable;
alternateParseTable = parsestate;
parsestate = tmp;
}
break;
case CASE_SCR_STATE: // ESC #
+6 -6
View File
@@ -4849,7 +4849,7 @@ CASE_PRINT,
CASE_PRINT,
/* ` a b c */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT_GRA,
CASE_PRINT,
CASE_PRINT,
/* d e f g */
@@ -4865,7 +4865,7 @@ CASE_PRINT_GRA,
/* l m n o */
CASE_PRINT_GRA,
CASE_PRINT_GRA,
CASE_PRINT,
CASE_PRINT_GRA,
CASE_PRINT,
/* p q r s */
CASE_PRINT,
@@ -4873,10 +4873,10 @@ CASE_PRINT_GRA,
CASE_PRINT,
CASE_PRINT,
/* t u v w */
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT,
CASE_PRINT_GRA,
CASE_PRINT_GRA,
CASE_PRINT_GRA,
CASE_PRINT_GRA,
/* x y z { */
CASE_PRINT_GRA,
CASE_PRINT,