Skip to content

Commit

Permalink
Merge changes from Fonzoterm :
Browse files Browse the repository at this point in the history
 - Report the terminal as xterm-color instead of just xterm, since we handle that fine.
 - Tweak the SGR handler a bit to use bright rather than bold in some cases
 - Change the color palette so the result is still readable (white on white doesn't work so well) with the default colorscheme.
  • Loading branch information
pulkomandy committed Jan 9, 2013
1 parent 713f1b8 commit 2b67e9a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/apps/terminal/Shell.cpp
Expand Up @@ -539,7 +539,7 @@ Shell::_Spawn(int row, int col, const ShellParameters& parameters)
/*
* setenv TERM and TTY.
*/
setenv("TERM", "xterm", true);
setenv("TERM", "xterm-color", true);
setenv("TTY", ttyName, true);
setenv("TTYPE", parameters.Encoding(), true);

Expand Down
23 changes: 15 additions & 8 deletions src/apps/terminal/TermParse.cpp
Expand Up @@ -833,23 +833,30 @@ TermParse::EscParse()
fAttr = FORECOLORED(7);
break;

case 1: /* Bold */
case 5:
fAttr |= BOLD;
case 1: /* Bright / Bold */
fAttr |= FORECOLORED(8);
fAttr |= FORESET;
break;

case 4: /* Underline */
fAttr |= UNDERLINE;
break;

case 5:
fAttr |= BOLD;
break;

case 7: /* Inverse */
fAttr |= INVERSE;
break;

case 22: /* Not Bold */
fAttr &= ~BOLD;
case 2: /* Faint: decreased intensity */
case 21: /* Bright/Bold: off or Underline: Double */
case 22: /* Not Bold, not bright, not faint */
fAttr &= ~(FORECOLORED(8) | BOLD);
fAttr |= FORESET;
break;

case 24: /* Not Underline */
fAttr &= ~UNDERLINE;
break;
Expand All @@ -866,7 +873,7 @@ TermParse::EscParse()
case 35:
case 36:
case 37:
fAttr &= ~FORECOLOR;
fAttr &= ~FORECOLORED(7);
fAttr |= FORECOLORED(param[row] - 30);
fAttr |= FORESET;
break;
Expand All @@ -875,7 +882,7 @@ TermParse::EscParse()
{
if (nparam != 3 || param[1] != 5)
break;
fAttr &= ~FORECOLOR;
fAttr &= ~FORECOLORED(255 - 8);
fAttr |= FORECOLORED(param[2]);
fAttr |= FORESET;

Expand Down
4 changes: 2 additions & 2 deletions src/apps/terminal/TermView.cpp
Expand Up @@ -79,14 +79,14 @@ static rgb_color kTermColorTable[256] = {
{ 6, 152, 154, 0}, // cyan
{245, 245, 245, 0}, // white

{128, 128, 128, 0}, // black
{ 64, 64, 64, 0}, // black
{255, 0, 0, 0}, // red
{ 0, 255, 0, 0}, // green
{255, 255, 0, 0}, // yellow
{ 0, 0, 255, 0}, // blue
{255, 0, 255, 0}, // magenta
{ 0, 255, 255, 0}, // cyan
{255, 255, 255, 0}, // white
{128, 128, 128, 0}, // white

{ 0, 0, 0, 0},
{ 0, 0, 51, 0},
Expand Down

0 comments on commit 2b67e9a

Please sign in to comment.