diff options
Diffstat (limited to 'src/screen.c')
-rw-r--r-- | src/screen.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/screen.c b/src/screen.c index 51c7f99..cda63fb 100644 --- a/src/screen.c +++ b/src/screen.c @@ -595,8 +595,15 @@ static void resize_buffer(VTermScreen *screen, int bufidx, int new_rows, int new new_row_start, new_row_end, old_row_start, old_row_end, width); #endif - if(new_row_start < 0) + if(new_row_start < 0) { + if(old_row_start <= old_cursor.row && old_cursor.row < old_row_end) { + new_cursor.row = 0; + new_cursor.col = old_cursor.col; + if(new_cursor.col >= new_cols) + new_cursor.col = new_cols-1; + } break; + } for(new_row = new_row_start, old_row = old_row_start; new_row <= new_row_end; new_row++) { int count = width >= new_cols ? new_cols : width; @@ -660,8 +667,9 @@ static void resize_buffer(VTermScreen *screen, int bufidx, int new_rows, int new if(old_row >= 0 && bufidx == BUFIDX_PRIMARY) { /* Push spare lines to scrollback buffer */ - for(int row = 0; row <= old_row; row++) - sb_pushline_from_row(screen, row); + if(screen->callbacks && screen->callbacks->sb_pushline) + for(int row = 0; row <= old_row; row++) + sb_pushline_from_row(screen, row); if(active) statefields->pos.row -= (old_row + 1); } |