From 06561d350036d972507dc155ee10dfa65f9d697e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20=22Tracerneo=22=20Zi=C3=B3=C5=82kowski?= Date: Fri, 28 Jun 2013 04:28:32 +0200 Subject: [PATCH] Add support for ECMA-48 escape sequence for italic Closes #443 --- src/terminal/terminalframebuffer.cc | 6 ++++-- src/terminal/terminalframebuffer.h | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/terminal/terminalframebuffer.cc b/src/terminal/terminalframebuffer.cc index 7eacb9c..dfd2d34 100644 --- a/src/terminal/terminalframebuffer.cc +++ b/src/terminal/terminalframebuffer.cc @@ -388,7 +388,7 @@ void DrawState::resize( int s_width, int s_height ) } 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 ), background_color( s_background ) {} @@ -397,7 +397,7 @@ Renditions::Renditions( int s_background ) void Renditions::set_rendition( int num ) { if ( num == 0 ) { - bold = underlined = blink = inverse = invisible = false; + bold = italic = underlined = blink = inverse = invisible = false; foreground_color = background_color = 0; return; } @@ -426,6 +426,7 @@ void Renditions::set_rendition( int num ) switch ( num ) { 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 5: case 25: blink = (num == 5); break; case 7: case 27: inverse = (num == 7); break; @@ -453,6 +454,7 @@ std::string Renditions::sgr( void ) const ret.append( "\033[0" ); if ( bold ) ret.append( ";1" ); + if ( italic ) ret.append( ";3" ); if ( underlined ) ret.append( ";4" ); if ( blink ) ret.append( ";5" ); if ( inverse ) ret.append( ";7" ); diff --git a/src/terminal/terminalframebuffer.h b/src/terminal/terminalframebuffer.h index f0a395c..1d5d88a 100644 --- a/src/terminal/terminalframebuffer.h +++ b/src/terminal/terminalframebuffer.h @@ -44,7 +44,7 @@ namespace Terminal { class Renditions { public: - bool bold, underlined, blink, inverse, invisible; + bool bold, italic, underlined, blink, inverse, invisible; int foreground_color; int background_color; @@ -58,7 +58,7 @@ namespace Terminal { 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) && (invisible == x.invisible) && (foreground_color == x.foreground_color) && (background_color == x.background_color);