1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:17:34 +00:00

Terminal: Fix some missing text attributes

Probably doesn't actually change much yet since we don't support many
text rendering options, but it's at least good to have the options, and
to record things we don't yet support too.
This commit is contained in:
Robin Burchell 2019-05-29 21:10:08 +02:00 committed by Andreas Kling
parent 96db775ac1
commit 004a630bfe
2 changed files with 66 additions and 7 deletions

View file

@ -16,6 +16,8 @@
#include <sys/ioctl.h>
//#define TERMINAL_DEBUG
byte Terminal::Attribute::default_foreground_color = 7;
byte Terminal::Attribute::default_background_color = 0;
Terminal::Terminal(int ptm_fd, RetainPtr<CConfigFile> config)
: m_ptm_fd(ptm_fd)
@ -157,8 +159,34 @@ void Terminal::escape$m(const ParamVector& params)
m_current_attribute.reset();
break;
case 1:
// Bold
//m_current_attribute.bold = true;
m_current_attribute.flags |= Attribute::Bold;
break;
case 3:
m_current_attribute.flags |= Attribute::Italic;
break;
case 4:
m_current_attribute.flags |= Attribute::Underline;
break;
case 5:
m_current_attribute.flags |= Attribute::Blink;
break;
case 7:
m_current_attribute.flags |= Attribute::Negative;
break;
case 22:
m_current_attribute.flags &= ~Attribute::Bold;
break;
case 23:
m_current_attribute.flags &= ~Attribute::Italic;
break;
case 24:
m_current_attribute.flags &= ~Attribute::Underline;
break;
case 25:
m_current_attribute.flags &= ~Attribute::Blink;
break;
case 27:
m_current_attribute.flags &= ~Attribute::Negative;
break;
case 30:
case 31:
@ -169,8 +197,14 @@ void Terminal::escape$m(const ParamVector& params)
case 36:
case 37:
// Foreground color
if (m_current_attribute.flags & Attribute::Bold)
param += 8;
m_current_attribute.foreground_color = param - 30;
break;
case 39:
// reset foreground
m_current_attribute.foreground_color = Attribute::default_foreground_color;
break;
case 40:
case 41:
case 42:
@ -180,8 +214,16 @@ void Terminal::escape$m(const ParamVector& params)
case 46:
case 47:
// Background color
if (m_current_attribute.flags & Attribute::Bold)
param += 8;
m_current_attribute.background_color = param - 40;
break;
case 49:
// reset background
m_current_attribute.background_color = Attribute::default_background_color;
break;
default:
dbgprintf("FIXME: escape$m: p: %u\n", param);
}
}
}