Fix crash involving one-column-wide terminals and resizing with wide chars
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <assert.h>
|
||||
|
||||
/* Terminal framebuffer */
|
||||
|
||||
@@ -171,6 +172,13 @@ namespace Terminal {
|
||||
|
||||
inline Cell *get_cell( void )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
assert( ds.get_cursor_row() >= 0 );
|
||||
assert( ds.get_cursor_col() >= 0 );
|
||||
assert( ds.get_cursor_row() < ds.get_height() );
|
||||
assert( ds.get_cursor_col() < ds.get_width() );
|
||||
#endif
|
||||
|
||||
return &rows[ ds.get_cursor_row() ].cells[ ds.get_cursor_col() ];
|
||||
}
|
||||
|
||||
@@ -179,6 +187,13 @@ namespace Terminal {
|
||||
if ( row == -1 ) row = ds.get_cursor_row();
|
||||
if ( col == -1 ) col = ds.get_cursor_col();
|
||||
|
||||
#ifdef DEBUG
|
||||
assert( row >= 0 );
|
||||
assert( col >= 0 );
|
||||
assert( row < ds.get_height() );
|
||||
assert( col < ds.get_width() );
|
||||
#endif
|
||||
|
||||
return &rows[ row ].cells[ col ];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user