diff --git a/src/frontend/terminaloverlay.cc b/src/frontend/terminaloverlay.cc index bbd9354..4879b96 100644 --- a/src/frontend/terminaloverlay.cc +++ b/src/frontend/terminaloverlay.cc @@ -280,7 +280,7 @@ void NotificationEngine::apply( Framebuffer &fb ) const this_cell->get_renditions().background_color = 44; this_cell->append( ch ); - this_cell->set_width( chwidth ); + this_cell->set_wide( chwidth == 2 ); combining_cell = this_cell; overlay_col += chwidth; @@ -291,7 +291,7 @@ void NotificationEngine::apply( Framebuffer &fb ) const } if ( combining_cell->empty() ) { - assert( combining_cell->get_width() == 1 ); + assert( !combining_cell->get_wide() ); combining_cell->set_fallback( true ); overlay_col++; } diff --git a/src/terminal/terminal.cc b/src/terminal/terminal.cc index 57a465c..2f9119b 100644 --- a/src/terminal/terminal.cc +++ b/src/terminal/terminal.cc @@ -106,7 +106,7 @@ void Emulator::print( const Parser::Print *act ) fb.reset_cell( this_cell ); this_cell->append( ch ); - this_cell->set_width( chwidth ); + this_cell->set_wide( chwidth == 2 ); /* chwidth had better be 1 or 2 here */ fb.apply_renditions_to_cell( this_cell ); if ( chwidth == 2 ) { /* erase overlapped cell */ @@ -131,7 +131,7 @@ void Emulator::print( const Parser::Print *act ) base character [e.g. start of line], if the combining character has been cleared with a sequence like ED ("J") or EL ("K") */ - assert( combining_cell->get_width() == 1 ); + assert( !combining_cell->get_wide() ); combining_cell->set_fallback( true ); fb.ds.move_col( 1, true, true ); } diff --git a/src/terminal/terminalframebuffer.cc b/src/terminal/terminalframebuffer.cc index 7132893..6905183 100644 --- a/src/terminal/terminalframebuffer.cc +++ b/src/terminal/terminalframebuffer.cc @@ -41,14 +41,14 @@ using namespace Terminal; Cell::Cell( color_type background_color ) : contents(), renditions( background_color ), - width( 1 ), + wide( false ), fallback( false ), wrap( false ) {} Cell::Cell() /* default constructor required by C++11 STL */ : contents(), renditions( 0 ), - width( 1 ), + wide( false ), fallback( false ), wrap( false ) { @@ -59,7 +59,7 @@ void Cell::reset( color_type background_color ) { contents.clear(); renditions = Renditions( background_color ); - width = 1; + wide = false; fallback = false; wrap = false; } @@ -642,10 +642,10 @@ bool Cell::compare( const Cell &other ) const fallback, other.fallback ); } - if ( width != other.width ) { + if ( wide != other.wide ) { ret = true; fprintf( stderr, "width: %d vs. %d\n", - width, other.width ); + wide, other.wide ); } if ( !(renditions == other.renditions) ) { diff --git a/src/terminal/terminalframebuffer.h b/src/terminal/terminalframebuffer.h index c21c514..ca669ab 100644 --- a/src/terminal/terminalframebuffer.h +++ b/src/terminal/terminalframebuffer.h @@ -89,7 +89,7 @@ namespace Terminal { typedef std::string content_type; /* can be std::string, std::vector, or __gnu_cxx::__vstring */ content_type contents; Renditions renditions; - unsigned int width : 2; + unsigned int wide : 1; /* 0 = narrow, 1 = wide */ unsigned int fallback : 1; /* first character is combining character */ unsigned int wrap : 1; @@ -103,7 +103,7 @@ namespace Terminal { { return ( (contents == x.contents) && (fallback == x.fallback) - && (width == x.width) + && (wide == x.wide) && (renditions == x.renditions) && (wrap == x.wrap) ); } @@ -190,8 +190,9 @@ namespace Terminal { const Renditions& get_renditions( void ) const { return renditions; } Renditions& get_renditions( void ) { return renditions; } void set_renditions( const Renditions& r ) { renditions = r; } - unsigned int get_width( void ) const { return width; } - void set_width( unsigned int w ) { width = w; } + bool get_wide( void ) const { return wide; } + void set_wide( bool w ) { wide = w; } + unsigned int get_width( void ) const { return wide + 1; } bool get_fallback( void ) const { return fallback; } void set_fallback( bool f ) { fallback = f; } bool get_wrap( void ) const { return wrap; }