summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/grid-view.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2011-01-25 23:40:26 +0000
committernicm <nicm@openbsd.org>2011-01-25 23:40:26 +0000
commit0864dd213b83039bca052f4e9d25ab4ca492fa11 (patch)
tree7ceda979de5e8ef5bda1def7f6dd427d31957a40 /usr.bin/tmux/grid-view.c
parentMake the pthread scheduler block signals while restoring a newly (diff)
downloadwireguard-openbsd-0864dd213b83039bca052f4e9d25ab4ca492fa11.tar.xz
wireguard-openbsd-0864dd213b83039bca052f4e9d25ab4ca492fa11.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 'usr.bin/tmux/grid-view.c')
-rw-r--r--usr.bin/tmux/grid-view.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/usr.bin/tmux/grid-view.c b/usr.bin/tmux/grid-view.c
index dbf42980fe4..f9e603f2700 100644
--- a/usr.bin/tmux/grid-view.c
+++ b/usr.bin/tmux/grid-view.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grid-view.c,v 1.8 2009/12/03 22:50:10 nicm Exp $ */
+/* $OpenBSD: grid-view.c,v 1.9 2011/01/25 23:40:26 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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)