diff options
-rw-r--r-- | libcons/ChangeLog | 5 | ||||
-rw-r--r-- | libcons/vcons-refresh.c | 34 |
2 files changed, 25 insertions, 14 deletions
diff --git a/libcons/ChangeLog b/libcons/ChangeLog index 5a34bd41..27133687 100644 --- a/libcons/ChangeLog +++ b/libcons/ChangeLog @@ -1,3 +1,8 @@ +2002-09-22 Marcus Brinkmann <marcus@gnu.org> + + * vcons-refresh.c (cons_vcons_refresh): Take VCONS->scrolling into + account. + 2002-09-17 Marcus Brinkmann <marcus@gnu.org> * opts-std-startup.c (OPT_NO_JUMP_DOWN_ON_INPUT): New macro. diff --git a/libcons/vcons-refresh.c b/libcons/vcons-refresh.c index 7851618a..ec899a91 100644 --- a/libcons/vcons-refresh.c +++ b/libcons/vcons-refresh.c @@ -27,6 +27,7 @@ void cons_vcons_refresh (vcons_t vcons) { + uint32_t start; vcons->state.screen.cur_line = vcons->display->screen.cur_line; vcons->state.screen.scr_lines = vcons->display->screen.scr_lines; vcons->state.cursor.col = vcons->display->cursor.col; @@ -37,32 +38,37 @@ cons_vcons_refresh (vcons_t vcons) vcons->state.flags = vcons->display->flags; vcons->state.changes.written = vcons->display->changes.written; + if (vcons->state.screen.scr_lines < vcons->scrolling) + vcons->scrolling = vcons->scrolling; + cons_vcons_clear (vcons, vcons->state.screen.width * vcons->state.screen.height, 0, 0); + + if (vcons->state.screen.cur_line >= vcons->scrolling) + start = vcons->state.screen.cur_line - vcons->scrolling; + else + start = (UINT32_MAX + - (vcons->scrolling - vcons->state.screen.cur_line)) + 1; + start %= vcons->state.screen.lines; + cons_vcons_write (vcons, vcons->state.screen.matrix - + (vcons->state.screen.cur_line % vcons->state.screen.lines) - * vcons->state.screen.width, - ((vcons->state.screen.lines - - (vcons->state.screen.cur_line % vcons->state.screen.lines) + + start * vcons->state.screen.width, + ((vcons->state.screen.lines - start < vcons->state.screen.height) - ? vcons->state.screen.lines - - (vcons->state.screen.cur_line % vcons->state.screen.lines) + ? vcons->state.screen.lines - start : vcons->state.screen.height) * vcons->state.screen.width, 0, 0); - if (vcons->state.screen.lines - - (vcons->state.screen.cur_line % vcons->state.screen.lines) - < vcons->state.screen.height) + if (vcons->state.screen.lines - start < vcons->state.screen.height) cons_vcons_write (vcons, vcons->state.screen.matrix, vcons->state.screen.height * vcons->state.screen.width - - (vcons->state.screen.lines - - (vcons->state.screen.cur_line % vcons->state.screen.lines)) + - (vcons->state.screen.lines - start) * vcons->state.screen.width, 0, - vcons->state.screen.lines - - (vcons->state.screen.cur_line % vcons->state.screen.lines)); + vcons->state.screen.lines - start); cons_vcons_set_cursor_pos (vcons, vcons->state.cursor.col, vcons->state.cursor.row); cons_vcons_set_cursor_status (vcons, vcons->state.cursor.status); - cons_vcons_set_scroll_lock (vcons, vcons->state.flags & CONS_FLAGS_SCROLL_LOCK); + cons_vcons_set_scroll_lock (vcons, vcons->state.flags + & CONS_FLAGS_SCROLL_LOCK); cons_vcons_update (vcons); } |