summaryrefslogtreecommitdiffstats
path: root/grid.c
diff options
context:
space:
mode:
authornicm <nicm>2020-03-31 17:13:20 +0000
committernicm <nicm>2020-03-31 17:13:20 +0000
commite6cddcf752b335cb945bba4619b500b527cfee0a (patch)
tree14c221ec9118347f15f4626aabf095df2104c769 /grid.c
parent2624edde46ad13995d4dd33f7d61fce74ac8f1ac (diff)
Add a -T flag to resize-pane to trim lines below the cursor, moving
lines out of the history. GitHub issue 2134.
Diffstat (limited to 'grid.c')
-rw-r--r--grid.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/grid.c b/grid.c
index 29943e6b..9678bf59 100644
--- a/grid.c
+++ b/grid.c
@@ -351,6 +351,19 @@ grid_collect_history(struct grid *gd)
gd->hscrolled = gd->hsize;
}
+/* Remove lines from the bottom of the history. */
+void
+grid_remove_history(struct grid *gd, u_int ny)
+{
+ u_int yy;
+
+ if (ny > gd->hsize)
+ return;
+ for (yy = 0; yy < ny; yy++)
+ grid_free_line(gd, gd->hsize + gd->sy - 1 - yy);
+ gd->hsize -= ny;
+}
+
/*
* Scroll the entire visible screen, moving one line into the history. Just
* allocate a new line at the bottom and move the history size indicator.