summaryrefslogtreecommitdiff
path: root/libcons/vcons-refresh.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2002-09-22 02:05:47 +0000
committerMarcus Brinkmann <marcus@gnu.org>2002-09-22 02:05:47 +0000
commit1eb7ad1b73de1d61587a892efb4b10da02ae1537 (patch)
tree2d5b1022312671629f226688a4d6d6f7a463a3cc /libcons/vcons-refresh.c
parent2e9c58228926f8d0e63fa4e0a7e97942b7da0a42 (diff)
2002-09-22 Marcus Brinkmann <marcus@gnu.org>
* vcons-refresh.c (cons_vcons_refresh): Take VCONS->scrolling into account.
Diffstat (limited to 'libcons/vcons-refresh.c')
-rw-r--r--libcons/vcons-refresh.c34
1 files changed, 20 insertions, 14 deletions
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);
}