diff options
author | 2014-06-20 10:46:59 +0000 | |
---|---|---|
committer | 2014-06-20 10:46:59 +0000 | |
commit | c1b85bb4d06080879736985039558dacd42cf51a (patch) | |
tree | 866593a62a2d4fcb75cf7fbb86ebeda07f977651 /usr.bin/tmux/cmd-capture-pane.c | |
parent | Fix incorrect bounds check in amd64 assembly version of bn_mul_mont(); (diff) | |
download | wireguard-openbsd-c1b85bb4d06080879736985039558dacd42cf51a.tar.xz wireguard-openbsd-c1b85bb4d06080879736985039558dacd42cf51a.zip |
Make -S- and -E- mean the start and end to capture-pane to avoid having
to faff around with huge numbers to get everything.
Diffstat (limited to 'usr.bin/tmux/cmd-capture-pane.c')
-rw-r--r-- | usr.bin/tmux/cmd-capture-pane.c | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/usr.bin/tmux/cmd-capture-pane.c b/usr.bin/tmux/cmd-capture-pane.c index 17913ba9ba3..b6d57955c06 100644 --- a/usr.bin/tmux/cmd-capture-pane.c +++ b/usr.bin/tmux/cmd-capture-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-capture-pane.c,v 1.27 2014/05/13 07:34:35 nicm Exp $ */ +/* $OpenBSD: cmd-capture-pane.c,v 1.28 2014/06/20 10:46:59 nicm Exp $ */ /* * Copyright (c) 2009 Jonathan Alvarado <radobobo@users.sourceforge.net> @@ -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; |