diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2020-03-31 17:13:21 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2020-03-31 17:13:21 +0000 |
commit | a50cb7ffe73f1e00829305a3b87bced6370b8e48 (patch) | |
tree | 667d12bb563fc7b6311f68ecd18464673278426e /usr.bin/tmux/grid.c | |
parent | 80fc65bc79a7f68cd2e17e4f1197dff3a3bf6718 (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 'usr.bin/tmux/grid.c')
-rw-r--r-- | usr.bin/tmux/grid.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.bin/tmux/grid.c b/usr.bin/tmux/grid.c index 63af07bf461..f4f6b87e531 100644 --- a/usr.bin/tmux/grid.c +++ b/usr.bin/tmux/grid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grid.c,v 1.103 2020/03/21 13:51:30 nicm Exp $ */ +/* $OpenBSD: grid.c,v 1.104 2020/03/31 17:13:20 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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. |