Implement tabs

This commit is contained in:
Keith Winstein
2011-01-31 06:10:02 -05:00
parent e4dce8f6e2
commit 92d80accf9
5 changed files with 63 additions and 3 deletions
+22 -2
View File
@@ -56,8 +56,8 @@ void Cell::reset( void )
DrawState::DrawState( int s_width, int s_height )
: width( s_width ), height( s_height ),
cursor_col( 0 ), cursor_row( 0 ),
combining_char_col( 0 ), combining_char_row( 0 ),
next_print_will_wrap( false )
combining_char_col( 0 ), combining_char_row( 0 ), tabs( s_width ),
next_print_will_wrap( false ), auto_wrap_mode( true )
{}
Framebuffer::Framebuffer( int s_width, int s_height )
@@ -179,3 +179,23 @@ void Framebuffer::claim_overlap( int row, int col )
}
}
}
void DrawState::set_tab( void )
{
tabs[ cursor_col ] = true;
}
void DrawState::clear_tab( int col )
{
tabs[ col ] = false;
}
int DrawState::get_next_tab( void )
{
for ( int i = cursor_col + 1; i < width; i++ ) {
if ( tabs[ i ] ) {
return i;
}
}
return -1;
}