From e6cddcf752b335cb945bba4619b500b527cfee0a Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 31 Mar 2020 17:13:20 +0000 Subject: Add a -T flag to resize-pane to trim lines below the cursor, moving lines out of the history. GitHub issue 2134. --- grid.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'grid.c') 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. -- cgit