summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd-capture-pane.c47
-rw-r--r--tmux.16
2 files changed, 35 insertions, 18 deletions
diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c
index c6a80ebd..e3c551ab 100644
--- a/cmd-capture-pane.c
+++ b/cmd-capture-pane.c
@@ -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;
diff --git a/tmux.1 b/tmux.1
index 9a5a1c4d..f70ac391 100644
--- a/tmux.1
+++ b/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