version 1.26, 2014/04/24 09:14:43 |
version 1.27, 2014/05/13 07:34:35 |
|
|
const struct cmd_entry cmd_capture_pane_entry = { |
const struct cmd_entry cmd_capture_pane_entry = { |
"capture-pane", "capturep", |
"capture-pane", "capturep", |
"ab:CeE:JpPqS:t:", 0, 0, |
"ab:CeE:JpPqS:t:", 0, 0, |
"[-aCeJpPq] [-b buffer-index] [-E end-line] [-S start-line]" |
"[-aCeJpPq] " CMD_BUFFER_USAGE " [-E end-line] [-S start-line]" |
CMD_TARGET_PANE_USAGE, |
CMD_TARGET_PANE_USAGE, |
0, |
0, |
NULL, |
NULL, |
|
|
struct client *c; |
struct client *c; |
struct window_pane *wp; |
struct window_pane *wp; |
char *buf, *cause; |
char *buf, *cause; |
int buffer; |
const char *bufname; |
u_int limit; |
|
size_t len; |
size_t len; |
|
|
if (cmd_find_pane(cmdq, args_get(args, 't'), NULL, &wp) == NULL) |
if (cmd_find_pane(cmdq, args_get(args, 't'), NULL, &wp) == NULL) |
|
|
evbuffer_add(c->stdout_data, "\n", 1); |
evbuffer_add(c->stdout_data, "\n", 1); |
server_push_stdout(c); |
server_push_stdout(c); |
} else { |
} else { |
limit = options_get_number(&global_options, "buffer-limit"); |
|
if (!args_has(args, 'b')) { |
|
paste_add(buf, len, limit); |
|
return (CMD_RETURN_NORMAL); |
|
} |
|
|
|
buffer = args_strtonum(args, 'b', 0, INT_MAX, &cause); |
bufname = NULL; |
if (cause != NULL) { |
if (args_has(args, 'b')) |
cmdq_error(cmdq, "buffer %s", cause); |
bufname = args_get(args, 'b'); |
free(buf); |
|
free(cause); |
|
return (CMD_RETURN_ERROR); |
|
} |
|
|
|
if (paste_replace(buffer, buf, len) != 0) { |
if (paste_set(buf, len, bufname, &cause) != 0) { |
cmdq_error(cmdq, "no buffer %d", buffer); |
cmdq_error(cmdq, "%s", cause); |
free(buf); |
free(buf); |
|
free(cause); |
return (CMD_RETURN_ERROR); |
return (CMD_RETURN_ERROR); |
} |
} |
} |
} |