summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2002-08-28 17:28:36 +0000
committerMarcus Brinkmann <marcus@gnu.org>2002-08-28 17:28:36 +0000
commit513afcf4f8cd67275bad59251d1ee2a845d0ddca (patch)
tree50ba58bd26fca25385be71fb144daadc287063b9
parentd14e2936fd203532ed19471c504b5b43adecf74b (diff)
hurd/
2002-08-28 Marcus Brinkmann <marcus@gnu.org> * console.h (struct cons_display): Fix comment on CUR_LINE. console/ 2002-08-28 Marcus Brinkmann <marcus@gnu.org> * display.c (screen_fill): Take CUR_LINES modulo LINES. (screen_shift_left): Likewise. (screen_shift_right): Likewise. (linefeed): Don't take CUR_LINES modulo LINES here. libcons/ 2002-08-28 Marcus Brinkmann <marcus@gnu.org> * file-changed.c (cons_S_file_changed): Take NEW_CUR_LINE modulo VCONS->state.screen.lines where appropriate. Adapt calculation of SCROLLING, and limit it to the screen size. Only scroll at all if there is something to scroll. Fix calculation of scrolled-in area. * vcons-refresh.c (cons_vcons_refresh): Take VCONS->state.screen.cur_line modulo VCONS->state.screen.lines.
-rw-r--r--console/ChangeLog7
-rw-r--r--console/display.c21
-rw-r--r--hurd/ChangeLog4
-rw-r--r--hurd/console.h4
-rw-r--r--libcons/ChangeLog10
-rw-r--r--libcons/file-changed.c75
-rw-r--r--libcons/vcons-refresh.c16
7 files changed, 89 insertions, 48 deletions
diff --git a/console/ChangeLog b/console/ChangeLog
index 3522ff99..69830796 100644
--- a/console/ChangeLog
+++ b/console/ChangeLog
@@ -1,5 +1,12 @@
2002-08-28 Marcus Brinkmann <marcus@gnu.org>
+ * display.c (screen_fill): Take CUR_LINES modulo LINES.
+ (screen_shift_left): Likewise.
+ (screen_shift_right): Likewise.
+ (linefeed): Don't take CUR_LINES modulo LINES here.
+
+2002-08-28 Marcus Brinkmann <marcus@gnu.org>
+
* display.c (display_output_one): Also set USER->cursor.status to
normal for ECMA-48 <RIS> (hard reset).
diff --git a/console/display.c b/console/display.c
index bcdbac1b..908a1d06 100644
--- a/console/display.c
+++ b/console/display.c
@@ -829,8 +829,10 @@ screen_fill (display_t display, size_t col1, size_t row1, size_t col2,
size_t row2, wchar_t chr, conchar_attr_t attr)
{
struct cons_display *user = display->user;
- off_t start = (user->screen.cur_line + row1) * user->screen.width + col1;
- off_t end = (user->screen.cur_line + row2) * user->screen.width + col2;
+ off_t start = ((user->screen.cur_line % user->screen.lines) + row1)
+ * user->screen.width + col1;
+ off_t end = ((user->screen.cur_line % user->screen.lines) + row2)
+ * user->screen.width + col2;
off_t size = user->screen.width * user->screen.lines;
if (start >= size && end >= size)
@@ -857,8 +859,10 @@ screen_shift_left (display_t display, size_t col1, size_t row1, size_t col2,
size_t row2, size_t shift, wchar_t chr, conchar_attr_t attr)
{
struct cons_display *user = display->user;
- off_t start = (user->screen.cur_line + row1) * user->screen.width + col1;
- off_t end = (user->screen.cur_line + row2) * user->screen.width + col2;
+ off_t start = ((user->screen.cur_line % user->screen.lines) + row1)
+ * user->screen.width + col1;
+ off_t end = ((user->screen.cur_line % user->screen.lines) + row2)
+ * user->screen.width + col2;
off_t size = user->screen.width * user->screen.lines;
if (start >= size && end >= size)
@@ -894,8 +898,10 @@ screen_shift_right (display_t display, size_t col1, size_t row1, size_t col2,
wchar_t chr, conchar_attr_t attr)
{
struct cons_display *user = display->user;
- off_t start = (user->screen.cur_line + row1) * user->screen.width + col1;
- off_t end = (user->screen.cur_line + row2) * user->screen.width + col2;
+ off_t start = ((user->screen.cur_line % user->screen.lines) + row1)
+ * user->screen.width + col1;
+ off_t end = ((user->screen.cur_line % user->screen.lines) + row2)
+ * user->screen.width + col2;
off_t size = user->screen.width * user->screen.lines;
if (start >= size && end >= size)
@@ -1080,7 +1086,6 @@ linefeed (display_t display)
else
{
user->screen.cur_line++;
- user->screen.cur_line %= user->screen.lines;
screen_fill (display, 0, user->screen.height - 1,
user->screen.width - 1, user->screen.height - 1,
@@ -1463,7 +1468,7 @@ display_output_one (display_t display, wchar_t chr)
else
{
/* XXX This implements the <bw> functionality.
- The alternative is to cut off and set x to 0. */
+ The alternative is to cut off and set col to 0. */
user->cursor.col = user->screen.width - 1;
user->cursor.row--;
}
diff --git a/hurd/ChangeLog b/hurd/ChangeLog
index 00de9a94..81f7d89a 100644
--- a/hurd/ChangeLog
+++ b/hurd/ChangeLog
@@ -1,3 +1,7 @@
+2002-08-28 Marcus Brinkmann <marcus@gnu.org>
+
+ * console.h (struct cons_display): Fix comment on CUR_LINE.
+
2002-08-22 Marcus Brinkmann <marcus@gnu.org>
* console.h: Move here from ../console/.
diff --git a/hurd/console.h b/hurd/console.h
index a6728a26..27ddeeb2 100644
--- a/hurd/console.h
+++ b/hurd/console.h
@@ -85,7 +85,9 @@ struct cons_display
{
uint32_t width; /* Width of screen matrix. */
uint32_t lines; /* Length of whole matrix. */
- uint32_t cur_line; /* Beginning of visible area. This is only
+ uint32_t cur_line; /* Virtual start of visible area. Needs to be
+ taken module LINES to get the real start of
+ visible area in the matrix. This is only
ever increased by the server, so clients
can optimize scrolling. */
uint32_t scr_lines; /* Number of lines in scrollback buffer
diff --git a/libcons/ChangeLog b/libcons/ChangeLog
index 2913619d..c9b7a5bf 100644
--- a/libcons/ChangeLog
+++ b/libcons/ChangeLog
@@ -1,3 +1,13 @@
+2002-08-28 Marcus Brinkmann <marcus@gnu.org>
+
+ * file-changed.c (cons_S_file_changed): Take NEW_CUR_LINE modulo
+ VCONS->state.screen.lines where appropriate. Adapt calculation of
+ SCROLLING, and limit it to the screen size.
+ Only scroll at all if there is something to scroll.
+ Fix calculation of scrolled-in area.
+ * vcons-refresh.c (cons_vcons_refresh): Take
+ VCONS->state.screen.cur_line modulo VCONS->state.screen.lines.
+
2002-08-22 Marcus Brinkmann <marcus@gnu.org>
* demuxer.c, init-init.c, init-loop.c, opts-version.c,
diff --git a/libcons/file-changed.c b/libcons/file-changed.c
index ff51fa29..a681d626 100644
--- a/libcons/file-changed.c
+++ b/libcons/file-changed.c
@@ -87,41 +87,50 @@ cons_S_file_changed (cons_notify_t notify, natural_t tickno,
}
if (change.what.screen_cur_line)
{
- off_t size = vcons->state.screen.width
- * vcons->state.screen.lines;
- off_t vis_start;
uint32_t new_cur_line;
- int scrolling;
- off_t start;
- off_t end;
new_cur_line = vcons->display->screen.cur_line;
- scrolling = new_cur_line - vcons->state.screen.cur_line;
- if (scrolling < 0)
- scrolling += vcons->state.screen.lines;
- cons_vcons_scroll (vcons, scrolling);
- vis_start = vcons->state.screen.width * new_cur_line;
- start = ((new_cur_line + vcons->state.screen.height
- - scrolling) * vcons->state.screen.width) % size;
- end = start + scrolling * vcons->state.screen.width - 1;
- cons_vcons_write (vcons, vcons->state.screen.matrix + start,
- end < size
- ? end - start + 1
- : size - start,
- (start - vis_start)
- % vcons->state.screen.width,
- (start - vis_start)
- / vcons->state.screen.width);
- if (end >= size)
- cons_vcons_write (vcons,
- vcons->state.screen.matrix,
- end - size + 1,
- (size - vis_start)
- % vcons->state.screen.width,
- (size - vis_start)
- / vcons->state.screen.width);
- cons_vcons_update (vcons);
- vcons->state.screen.cur_line = new_cur_line;
+ if (new_cur_line != vcons->state.screen.cur_line)
+ {
+ off_t size = vcons->state.screen.width
+ * vcons->state.screen.lines;
+ off_t vis_start;
+ uint32_t scrolling;
+ off_t start;
+ off_t end;
+
+ if (new_cur_line > vcons->state.screen.cur_line)
+ scrolling = new_cur_line
+ - vcons->state.screen.cur_line;
+ else
+ scrolling = UINT32_MAX - vcons->state.screen.cur_line
+ + 1 + new_cur_line;
+ if (scrolling > vcons->state.screen.height)
+ scrolling = vcons->state.screen.height;
+ if (scrolling < vcons->state.screen.height)
+ cons_vcons_scroll (vcons, scrolling);
+ vis_start = vcons->state.screen.width
+ * (new_cur_line % vcons->state.screen.lines);
+ start = (((new_cur_line % vcons->state.screen.lines)
+ + vcons->state.screen.height - scrolling)
+ * vcons->state.screen.width) % size;
+ end = start + scrolling * vcons->state.screen.width - 1;
+ cons_vcons_write (vcons,
+ vcons->state.screen.matrix + start,
+ end < size
+ ? end - start + 1
+ : size - start,
+ 0, vcons->state.screen.height
+ - scrolling);
+ if (end >= size)
+ cons_vcons_write (vcons,
+ vcons->state.screen.matrix,
+ end - size + 1,
+ 0, (size - vis_start)
+ / vcons->state.screen.width);
+ cons_vcons_update (vcons);
+ vcons->state.screen.cur_line = new_cur_line;
+ }
}
if (change.what.screen_scr_lines)
{
@@ -152,7 +161,7 @@ cons_S_file_changed (cons_notify_t notify, natural_t tickno,
/* For clipping. */
off_t size = vcons->state.screen.width*vcons->state.screen.lines;
off_t rotate = vcons->state.screen.width
- * vcons->state.screen.cur_line;
+ * (vcons->state.screen.cur_line % vcons->state.screen.lines);
off_t vis_end = vcons->state.screen.height
* vcons->state.screen.width - 1;
off_t end2 = -1;
diff --git a/libcons/vcons-refresh.c b/libcons/vcons-refresh.c
index 34f0de88..35e74224 100644
--- a/libcons/vcons-refresh.c
+++ b/libcons/vcons-refresh.c
@@ -37,21 +37,25 @@ cons_vcons_refresh (vcons_t vcons)
vcons->state.changes.written = vcons->display->changes.written;
cons_vcons_write (vcons, vcons->state.screen.matrix
- + vcons->state.screen.cur_line * vcons->state.screen.width,
- ((vcons->state.screen.lines - vcons->state.screen.cur_line
+ + (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)
< vcons->state.screen.height)
- ? vcons->state.screen.lines - vcons->state.screen.cur_line
+ ? vcons->state.screen.lines
+ - (vcons->state.screen.cur_line % vcons->state.screen.lines)
: vcons->state.screen.height)
* vcons->state.screen.width, 0, 0);
- if (vcons->state.screen.lines - vcons->state.screen.cur_line
+ if (vcons->state.screen.lines
+ - (vcons->state.screen.cur_line % vcons->state.screen.lines)
< 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.cur_line % vcons->state.screen.lines))
* vcons->state.screen.width, 0,
vcons->state.screen.lines
- - vcons->state.screen.cur_line);
+ - (vcons->state.screen.cur_line % vcons->state.screen.lines));
cons_vcons_set_cursor_pos (vcons, vcons->state.cursor.col,
vcons->state.cursor.row);