From d9291474d73e1a5d482b9175cb0717dd2a9fd544 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 21 Oct 2014 19:14:08 -0400 Subject: SU and SD were reversed from my scroll_up and scroll_down meanings --- src/screen.c | 70 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/screen.c b/src/screen.c index 354c95a..24d9b94 100644 --- a/src/screen.c +++ b/src/screen.c @@ -273,13 +273,13 @@ void vt100_screen_move_to(VT100Screen *vt, int row, int col, int scroll) if (row > bottom) { if (scroll) { - vt100_screen_scroll_down(vt, row - bottom); + vt100_screen_scroll_up(vt, row - bottom); } row = bottom; } else if (row < top) { if (scroll) { - vt100_screen_scroll_up(vt, top - row); + vt100_screen_scroll_down(vt, top - row); } row = top; } @@ -511,6 +511,39 @@ void vt100_screen_erase_characters(VT100Screen *vt, int count) } void vt100_screen_scroll_down(VT100Screen *vt, int count) +{ + struct vt100_row *row; + int bottom = vt->grid->scroll_bottom, top = vt->grid->scroll_top; + int i; + + if (bottom - top + 1 > count) { + for (i = 0; i < count; ++i) { + row = vt100_screen_row_at(vt, bottom - i); + free(row->cells); + } + row = vt100_screen_row_at(vt, top); + memmove( + row + count, row, + (bottom - top + 1 - count) * sizeof(struct vt100_row)); + for (i = 0; i < count; ++i) { + row = vt100_screen_row_at(vt, top + i); + row->cells = calloc(vt->grid->max.col, sizeof(struct vt100_cell)); + row->wrapped = 0; + } + } + else { + for (i = 0; i < bottom - top + 1; ++i) { + row = vt100_screen_row_at(vt, top + i); + memset( + row->cells, 0, vt->grid->max.col * sizeof(struct vt100_cell)); + row->wrapped = 0; + } + } + + vt->dirty = 1; +} + +void vt100_screen_scroll_up(VT100Screen *vt, int count) { struct vt100_row *row; int i; @@ -579,39 +612,6 @@ void vt100_screen_scroll_down(VT100Screen *vt, int count) vt->dirty = 1; } -void vt100_screen_scroll_up(VT100Screen *vt, int count) -{ - struct vt100_row *row; - int bottom = vt->grid->scroll_bottom, top = vt->grid->scroll_top; - int i; - - if (bottom - top + 1 > count) { - for (i = 0; i < count; ++i) { - row = vt100_screen_row_at(vt, bottom - i); - free(row->cells); - } - row = vt100_screen_row_at(vt, top); - memmove( - row + count, row, - (bottom - top + 1 - count) * sizeof(struct vt100_row)); - for (i = 0; i < count; ++i) { - row = vt100_screen_row_at(vt, top + i); - row->cells = calloc(vt->grid->max.col, sizeof(struct vt100_cell)); - row->wrapped = 0; - } - } - else { - for (i = 0; i < bottom - top + 1; ++i) { - row = vt100_screen_row_at(vt, top + i); - memset( - row->cells, 0, vt->grid->max.col * sizeof(struct vt100_cell)); - row->wrapped = 0; - } - } - - vt->dirty = 1; -} - void vt100_screen_set_scroll_region( VT100Screen *vt, int top, int bottom, int left, int right) { -- cgit v1.2.3