mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-26 18:13:10 +01:00
Make -S- and -E- mean the start and end to capture-pane to avoid having
to faff around with huge numbers to get everything.
This commit is contained in:
parent
00ac1af43f
commit
c8efffb4db
@ -94,6 +94,7 @@ cmd_capture_pane_history(struct args *args, struct cmd_q *cmdq,
|
||||
int n, with_codes, escape_c0, join_lines;
|
||||
u_int i, sx, top, bottom, tmp;
|
||||
char *cause, *buf, *line;
|
||||
const char *Sflag, *Eflag;
|
||||
size_t linelen;
|
||||
|
||||
sx = screen_size_x(&wp->base);
|
||||
@ -109,27 +110,37 @@ cmd_capture_pane_history(struct args *args, struct cmd_q *cmdq,
|
||||
} else
|
||||
gd = wp->base.grid;
|
||||
|
||||
n = args_strtonum(args, 'S', INT_MIN, SHRT_MAX, &cause);
|
||||
if (cause != NULL) {
|
||||
top = gd->hsize;
|
||||
free(cause);
|
||||
} else if (n < 0 && (u_int) -n > gd->hsize)
|
||||
Sflag = args_get(args, 'S');
|
||||
if (Sflag != NULL && strcmp(Sflag, "-") == 0)
|
||||
top = 0;
|
||||
else
|
||||
top = gd->hsize + n;
|
||||
if (top > gd->hsize + gd->sy - 1)
|
||||
top = gd->hsize + gd->sy - 1;
|
||||
else {
|
||||
n = args_strtonum(args, 'S', INT_MIN, SHRT_MAX, &cause);
|
||||
if (cause != NULL) {
|
||||
top = gd->hsize;
|
||||
free(cause);
|
||||
} else if (n < 0 && (u_int) -n > gd->hsize)
|
||||
top = 0;
|
||||
else
|
||||
top = gd->hsize + n;
|
||||
if (top > gd->hsize + gd->sy - 1)
|
||||
top = gd->hsize + gd->sy - 1;
|
||||
}
|
||||
|
||||
n = args_strtonum(args, 'E', INT_MIN, SHRT_MAX, &cause);
|
||||
if (cause != NULL) {
|
||||
bottom = gd->hsize + gd->sy - 1;
|
||||
free(cause);
|
||||
} else if (n < 0 && (u_int) -n > gd->hsize)
|
||||
bottom = 0;
|
||||
else
|
||||
bottom = gd->hsize + n;
|
||||
if (bottom > gd->hsize + gd->sy - 1)
|
||||
Eflag = args_get(args, 'E');
|
||||
if (Eflag != NULL && strcmp(Eflag, "-") == 0)
|
||||
bottom = gd->hsize + gd->sy - 1;
|
||||
else {
|
||||
n = args_strtonum(args, 'E', INT_MIN, SHRT_MAX, &cause);
|
||||
if (cause != NULL) {
|
||||
bottom = gd->hsize + gd->sy - 1;
|
||||
free(cause);
|
||||
} else if (n < 0 && (u_int) -n > gd->hsize)
|
||||
bottom = 0;
|
||||
else
|
||||
bottom = gd->hsize + n;
|
||||
if (bottom > gd->hsize + gd->sy - 1)
|
||||
bottom = gd->hsize + gd->sy - 1;
|
||||
}
|
||||
|
||||
if (bottom < top) {
|
||||
tmp = bottom;
|
||||
|
6
tmux.1
6
tmux.1
@ -1148,6 +1148,12 @@ and
|
||||
.Fl E
|
||||
specify the starting and ending line numbers, zero is the first line of the
|
||||
visible pane and negative numbers are lines in the history.
|
||||
.Ql -
|
||||
to
|
||||
.Fl S
|
||||
is the start of the history and to
|
||||
.Fl E
|
||||
the end of the visible pane.
|
||||
The default is to capture only the visible contents of the pane.
|
||||
.It Xo
|
||||
.Ic choose-client
|
||||
|
Loading…
Reference in New Issue
Block a user