diff options
author | 2020-03-31 17:13:20 +0000 | |
---|---|---|
committer | 2020-03-31 17:13:20 +0000 | |
commit | a0a1bba7a0578e824e0318e326dcdc217fa67321 (patch) | |
tree | 716d9943e496556a57910929b23658d89fd0361a /usr.bin/tmux/grid.c | |
parent | Add non-regex search variants to avoid the performance cost for people (diff) | |
download | wireguard-openbsd-a0a1bba7a0578e824e0318e326dcdc217fa67321.tar.xz wireguard-openbsd-a0a1bba7a0578e824e0318e326dcdc217fa67321.zip |
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. |