Add support for ECMA-48 escape sequence for italic

Closes #443
This commit is contained in:
Daniel "Tracerneo" Ziółkowski
2013-06-28 04:28:32 +02:00
committed by Keith Winstein
parent d8711618c9
commit 06561d3500
2 changed files with 6 additions and 4 deletions
+4 -2
View File
@@ -388,7 +388,7 @@ void DrawState::resize( int s_width, int s_height )
} }
Renditions::Renditions( int s_background ) Renditions::Renditions( int s_background )
: bold( false ), underlined( false ), blink( false ), : bold( false ), italic( false ), underlined( false ), blink( false ),
inverse( false ), invisible( false ), foreground_color( 0 ), inverse( false ), invisible( false ), foreground_color( 0 ),
background_color( s_background ) background_color( s_background )
{} {}
@@ -397,7 +397,7 @@ Renditions::Renditions( int s_background )
void Renditions::set_rendition( int num ) void Renditions::set_rendition( int num )
{ {
if ( num == 0 ) { if ( num == 0 ) {
bold = underlined = blink = inverse = invisible = false; bold = italic = underlined = blink = inverse = invisible = false;
foreground_color = background_color = 0; foreground_color = background_color = 0;
return; return;
} }
@@ -426,6 +426,7 @@ void Renditions::set_rendition( int num )
switch ( num ) { switch ( num ) {
case 1: case 22: bold = (num == 1); break; case 1: case 22: bold = (num == 1); break;
case 3: case 23: italic = (num == 3); break;
case 4: case 24: underlined = (num == 4); break; case 4: case 24: underlined = (num == 4); break;
case 5: case 25: blink = (num == 5); break; case 5: case 25: blink = (num == 5); break;
case 7: case 27: inverse = (num == 7); break; case 7: case 27: inverse = (num == 7); break;
@@ -453,6 +454,7 @@ std::string Renditions::sgr( void ) const
ret.append( "\033[0" ); ret.append( "\033[0" );
if ( bold ) ret.append( ";1" ); if ( bold ) ret.append( ";1" );
if ( italic ) ret.append( ";3" );
if ( underlined ) ret.append( ";4" ); if ( underlined ) ret.append( ";4" );
if ( blink ) ret.append( ";5" ); if ( blink ) ret.append( ";5" );
if ( inverse ) ret.append( ";7" ); if ( inverse ) ret.append( ";7" );
+2 -2
View File
@@ -44,7 +44,7 @@
namespace Terminal { namespace Terminal {
class Renditions { class Renditions {
public: public:
bool bold, underlined, blink, inverse, invisible; bool bold, italic, underlined, blink, inverse, invisible;
int foreground_color; int foreground_color;
int background_color; int background_color;
@@ -58,7 +58,7 @@ namespace Terminal {
bool operator==( const Renditions &x ) const bool operator==( const Renditions &x ) const
{ {
return (bold == x.bold) && (underlined == x.underlined) return (bold == x.bold) && (italic == x.italic) && (underlined == x.underlined)
&& (blink == x.blink) && (inverse == x.inverse) && (blink == x.blink) && (inverse == x.inverse)
&& (invisible == x.invisible) && (foreground_color == x.foreground_color) && (invisible == x.invisible) && (foreground_color == x.foreground_color)
&& (background_color == x.background_color); && (background_color == x.background_color);