diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2011-01-25 23:40:26 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2011-01-25 23:40:26 +0000 |
commit | ecc22c521d83f8ce480c0e2866fdf3ed14bd6131 (patch) | |
tree | 2c19f779004e1cf1a488996f97eebed40fded6fa /grid-view.c | |
parent | 1270f8fed8642ac61d14be6a3aeb8d002db82a78 (diff) | |
download | rtmux-ecc22c521d83f8ce480c0e2866fdf3ed14bd6131.tar.gz rtmux-ecc22c521d83f8ce480c0e2866fdf3ed14bd6131.tar.bz2 rtmux-ecc22c521d83f8ce480c0e2866fdf3ed14bd6131.zip |
When clearing the entire screen, clear lines that are used into the
history like xterm does. Requested ages ago by someone I've forgotten.
Diffstat (limited to 'grid-view.c')
-rw-r--r-- | grid-view.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/grid-view.c b/grid-view.c index ba142a1c..075feb6b 100644 --- a/grid-view.c +++ b/grid-view.c @@ -74,6 +74,30 @@ grid_view_set_utf8( grid_set_utf8(gd, grid_view_x(gd, px), grid_view_y(gd, py), gu); } +/* Clear into history. */ +void +grid_view_clear_history(struct grid *gd) +{ + struct grid_line *gl; + u_int yy, last; + + GRID_DEBUG(gd, ""); + + /* Find the last used line. */ + last = 0; + for (yy = 0; yy < gd->sy; yy++) { + gl = &gd->linedata[grid_view_y(gd, yy)]; + if (gl->cellsize != 0 || gl->utf8size != 0) + last = yy + 1; + } + if (last == 0) + return; + + /* Scroll the lines into the history. */ + for (yy = 0; yy < last; yy++) + grid_scroll_history(gd); +} + /* Clear area. */ void grid_view_clear(struct grid *gd, u_int px, u_int py, u_int nx, u_int ny) |