Mercurial > vim
diff src/libvterm/src/screen.c @ 20482:dc88c690f19b v8.2.0795
patch 8.2.0795: libvterm code lags behind the upstream version
Commit: https://github.com/vim/vim/commit/88d68de95da70d0f89a5246f58355d72e9c17db4
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon May 18 21:51:01 2020 +0200
patch 8.2.0795: libvterm code lags behind the upstream version
Problem: Libvterm code lags behind the upstream version.
Solution: Include revisions 748 - 754.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 18 May 2020 22:00:03 +0200 |
parents | d0bf39eb2b07 |
children | 1d595fada804 |
line wrap: on
line diff
--- a/src/libvterm/src/screen.c +++ b/src/libvterm/src/screen.c @@ -488,24 +488,9 @@ static void resize_buffer(VTermScreen *s ScreenCell *new_buffer = vterm_allocator_malloc(screen->vt, sizeof(ScreenCell) * new_rows * new_cols); /* Find the final row of old buffer content */ - int old_row; + int old_row = old_rows - 1; + int new_row = new_rows - 1; int col; - int new_row; - - for(old_row = old_rows - 1; old_row > 0; old_row--) { - if(active && (old_row == screen->state->pos.row)) - /* The line with the active cursor is never "blank" */ - goto found_oldrow; - for(col = 0; col < old_cols; col++) - if(old_buffer[old_row * old_cols + col].chars[0]) - /* This row is not blank */ - goto found_oldrow; - } - old_row = 0; -found_oldrow: - ; - - new_row = new_rows - 1; while(new_row >= 0 && old_row >= 0) { for(col = 0; col < old_cols && col < new_cols; col++) @@ -515,6 +500,15 @@ found_oldrow: old_row--; new_row--; + + if(new_row < 0 && old_row >= 0 && + new_buffer[(new_rows - 1) * new_cols].chars[0] == 0 && + (!active || statefields->pos.row < (new_rows - 1))) { + int moverows = new_rows - 1; + memmove(&new_buffer[1 * new_cols], &new_buffer[0], moverows * new_cols * sizeof(ScreenCell)); + + new_row++; + } } if(old_row >= 0 && bufidx == BUFIDX_PRIMARY) { @@ -877,7 +871,6 @@ VTermScreen *vterm_obtain_screen(VTerm * void vterm_screen_enable_altscreen(VTermScreen *screen, int altscreen) { - if(!screen->buffers[BUFIDX_ALTSCREEN] && altscreen) { int rows, cols; vterm_get_size(screen->vt, &rows, &cols);