diff options
author | nicm <nicm> | 2020-03-31 17:13:20 +0000 |
---|---|---|
committer | nicm <nicm> | 2020-03-31 17:13:20 +0000 |
commit | e6cddcf752b335cb945bba4619b500b527cfee0a (patch) | |
tree | 14c221ec9118347f15f4626aabf095df2104c769 /grid.c | |
parent | 2624edde46ad13995d4dd33f7d61fce74ac8f1ac (diff) | |
download | rtmux-e6cddcf752b335cb945bba4619b500b527cfee0a.tar.gz rtmux-e6cddcf752b335cb945bba4619b500b527cfee0a.tar.bz2 rtmux-e6cddcf752b335cb945bba4619b500b527cfee0a.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 'grid.c')
-rw-r--r-- | grid.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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. |