Update of /cvsroot/tmux/tmux
In directory vz-cvs-2.sog:/tmp/cvs-serv19693
Modified Files:
cmd-capture-pane.c tmux.1
Log Message:
|PatchSet 874
|Date: 2011/03/28 21:17:39
|Author: nicm
|Branch: HEAD
|Tag: (none)
|Log:
|Allow a start and end line to be specified for capture-pane which may be
|negative to capture part of the history. Prompted by request from Victor
|J Orlikowski.
Index: cmd-capture-pane.c
===================================================================
RCS file: /cvsroot/tmux/tmux/cmd-capture-pane.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- cmd-capture-pane.c 7 Jan 2011 14:45:33 -0000 1.6
+++ cmd-capture-pane.c 6 Apr 2011 22:19:42 -0000 1.7
@@ -31,8 +31,8 @@
const struct cmd_entry cmd_capture_pane_entry = {
"capture-pane", "capturep",
- "b:t:", 0, 0,
- "[-b buffer-index] [-t target-pane]",
+ "b:E:S:t:", 0, 0,
+ "[-b buffer-index] [-E end-line] [-S start-line] [-t target-pane]",
0,
NULL,
NULL,
@@ -46,19 +46,47 @@
struct window_pane *wp;
char *buf, *line, *cause;
struct screen *s;
- int buffer;
- u_int i, limit;
+ struct grid *gd;
+ int buffer, n;
+ u_int i, limit, top, bottom, tmp;
size_t len, linelen;
if (cmd_find_pane(ctx, args_get(args, 't'), NULL, &wp) == NULL)
return (-1);
s = &wp->base;
+ gd = s->grid;
buf = NULL;
len = 0;
- for (i = 0; i < screen_size_y(s); i++) {
- line = grid_view_string_cells(s->grid, 0, i, screen_size_x(s));
+ n = args_strtonum(args, 'S', SHRT_MIN, SHRT_MAX, &cause);
+ if (cause != NULL)
+ top = gd->hsize;
+ 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', SHRT_MIN, SHRT_MAX, &cause);
+ if (cause != NULL)
+ bottom = gd->hsize + gd->sy - 1;
+ 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;
+ bottom = top;
+ top = tmp;
+ }
+
+ for (i = top; i <= bottom; i++) {
+ line = grid_string_cells(s->grid, 0, i, screen_size_x(s));
linelen = strlen(line);
buf = xrealloc(buf, 1, len + linelen + 1);
Index: tmux.1
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.1,v
retrieving revision 1.297
retrieving revision 1.298
diff -u -d -r1.297 -r1.298
--- tmux.1 6 Apr 2011 22:16:33 -0000 1.297
+++ tmux.1 6 Apr 2011 22:19:42 -0000 1.298
@@ -957,11 +957,20 @@
is given, the new window does not become the current window.
.It Xo Ic capture-pane
.Op Fl b Ar buffer-index
+.Op Fl E Ar end-line
+.Op Fl S Ar start-line
.Op Fl t Ar target-pane
.Xc
.D1 (alias: Ic capturep )
Capture the contents of a pane to the specified buffer, or a new buffer if none
is specified.
+.Pp
+.Fl S
+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.
+The default is to capture only the visible contents of the pane.
.It Xo
.Ic choose-client
.Op Fl t Ar target-window
------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs