Move grapheme printing from FrameState::append_cell() to Framebuffer::Cell::print_grapheme().

This commit is contained in:
John Hood
2015-10-19 18:40:24 -04:00
parent 0b51260540
commit 66634eb97c
3 changed files with 18 additions and 16 deletions
+17
View File
@@ -113,6 +113,7 @@ namespace Terminal {
bool is_blank( void ) const
{
// XXX fix.
return ( contents.empty()
|| contents == " "
|| contents == "\xC2\xA0" );
@@ -161,6 +162,22 @@ namespace Terminal {
size_t len = wcrtomb(tmp, c, &ps);
contents.insert( contents.end(), tmp, tmp+len );
}
void print_grapheme( std::string &output ) const
{
if ( cell.contents.empty() ) {
output.append( ' ' );
return;
}
/*
* cells that begin with combining character get combiner
* attached to no-break space
*/
if ( cell.fallback ) {
output.append( "\xC2\xA0" );
}
output.append( cell.contents );
}
};
class Row {