mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
Add a -T flag to resize-pane to trim lines below the cursor, moving
lines out of the history. GitHub issue 2134.
This commit is contained in:
parent
2624edde46
commit
e6cddcf752
@ -36,8 +36,8 @@ const struct cmd_entry cmd_resize_pane_entry = {
|
|||||||
.name = "resize-pane",
|
.name = "resize-pane",
|
||||||
.alias = "resizep",
|
.alias = "resizep",
|
||||||
|
|
||||||
.args = { "DLMRt:Ux:y:Z", 0, 1 },
|
.args = { "DLMRTt:Ux:y:Z", 0, 1 },
|
||||||
.usage = "[-DLMRUZ] [-x width] [-y height] " CMD_TARGET_PANE_USAGE " "
|
.usage = "[-DLMRTUZ] [-x width] [-y height] " CMD_TARGET_PANE_USAGE " "
|
||||||
"[adjustment]",
|
"[adjustment]",
|
||||||
|
|
||||||
.target = { 't', CMD_FIND_PANE, 0 },
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
@ -60,6 +60,19 @@ cmd_resize_pane_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
char *cause;
|
char *cause;
|
||||||
u_int adjust;
|
u_int adjust;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
struct grid *gd = wp->base.grid;
|
||||||
|
|
||||||
|
if (args_has(args, 'T')) {
|
||||||
|
if (!TAILQ_EMPTY(&wp->modes))
|
||||||
|
return (CMD_RETURN_NORMAL);
|
||||||
|
adjust = screen_size_y(&wp->base) - 1 - wp->base.cy;
|
||||||
|
if (adjust > gd->hsize)
|
||||||
|
adjust = gd->hsize;
|
||||||
|
grid_remove_history(gd, adjust);
|
||||||
|
wp->base.cy += adjust;
|
||||||
|
wp->flags |= PANE_REDRAW;
|
||||||
|
return (CMD_RETURN_NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
if (args_has(args, 'M')) {
|
if (args_has(args, 'M')) {
|
||||||
if (cmd_mouse_window(&shared->mouse, &s) == NULL)
|
if (cmd_mouse_window(&shared->mouse, &s) == NULL)
|
||||||
|
13
grid.c
13
grid.c
@ -351,6 +351,19 @@ grid_collect_history(struct grid *gd)
|
|||||||
gd->hscrolled = gd->hsize;
|
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
|
* 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.
|
* allocate a new line at the bottom and move the history size indicator.
|
||||||
|
5
tmux.1
5
tmux.1
@ -2261,7 +2261,7 @@ Rename the current window, or the window at
|
|||||||
if specified, to
|
if specified, to
|
||||||
.Ar new-name .
|
.Ar new-name .
|
||||||
.It Xo Ic resize-pane
|
.It Xo Ic resize-pane
|
||||||
.Op Fl DLMRUZ
|
.Op Fl DLMRTUZ
|
||||||
.Op Fl t Ar target-pane
|
.Op Fl t Ar target-pane
|
||||||
.Op Fl x Ar width
|
.Op Fl x Ar width
|
||||||
.Op Fl y Ar height
|
.Op Fl y Ar height
|
||||||
@ -2300,6 +2300,9 @@ and unzoomed (its normal position in the layout).
|
|||||||
.Fl M
|
.Fl M
|
||||||
begins mouse resizing (only valid if bound to a mouse key binding, see
|
begins mouse resizing (only valid if bound to a mouse key binding, see
|
||||||
.Sx MOUSE SUPPORT ) .
|
.Sx MOUSE SUPPORT ) .
|
||||||
|
.Pp T
|
||||||
|
trims all lines below the current cursor position and moves lines out of the
|
||||||
|
history to replace them.
|
||||||
.It Xo Ic resize-window
|
.It Xo Ic resize-window
|
||||||
.Op Fl aADLRU
|
.Op Fl aADLRU
|
||||||
.Op Fl t Ar target-window
|
.Op Fl t Ar target-window
|
||||||
|
Loading…
Reference in New Issue
Block a user