LibVTerm: Integrate upstream changes

Change-Id: I9636eead9f9426f4d7754af8dede19956bc1fb8c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Marcus Tillmanns
2023-07-26 17:14:56 +02:00
parent 44189c4590
commit 55b9e3d151

View File

@@ -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);
}