Merge branch 'master' of ssh://git.code.sf.net/p/tmux/tmux-code

This commit is contained in:
Nicholas Marriott 2013-02-20 14:58:23 +00:00
commit 7905f4600d
3 changed files with 15 additions and 5 deletions

View File

@ -44,7 +44,7 @@ enum cmd_retval
cmd_capture_pane_exec(struct cmd *self, struct cmd_ctx *ctx) cmd_capture_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
{ {
struct args *args = self->args; struct args *args = self->args;
struct client *c = ctx->cmdclient; struct client *c;
struct window_pane *wp; struct window_pane *wp;
char *buf, *line, *cause; char *buf, *line, *cause;
struct screen *s; struct screen *s;
@ -106,6 +106,9 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
} }
if (args_has(args, 'p')) { if (args_has(args, 'p')) {
c = ctx->curclient;
if (c == NULL || !(c->flags & CLIENT_CONTROL))
c = ctx->cmdclient;
if (c == NULL) { if (c == NULL) {
ctx->error(ctx, "can't write to stdout"); ctx->error(ctx, "can't write to stdout");
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);

View File

@ -45,7 +45,7 @@ enum cmd_retval
cmd_save_buffer_exec(struct cmd *self, struct cmd_ctx *ctx) cmd_save_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
{ {
struct args *args = self->args; struct args *args = self->args;
struct client *c = ctx->cmdclient; struct client *c;
struct session *s; struct session *s;
struct paste_buffer *pb; struct paste_buffer *pb;
const char *path, *newpath, *wd; const char *path, *newpath, *wd;
@ -76,13 +76,17 @@ cmd_save_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
path = args->argv[0]; path = args->argv[0];
if (strcmp(path, "-") == 0) { if (strcmp(path, "-") == 0) {
c = ctx->curclient;
if (c == NULL || !(c->flags & CLIENT_CONTROL))
c = ctx->cmdclient;
if (c == NULL) { if (c == NULL) {
ctx->error(ctx, "%s: can't write to stdout", path); ctx->error(ctx, "can't write to stdout");
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
} }
evbuffer_add(c->stdout_data, pb->data, pb->size); evbuffer_add(c->stdout_data, pb->data, pb->size);
server_push_stdout(c); server_push_stdout(c);
} else { } else {
c = ctx->cmdclient;
if (c != NULL) if (c != NULL)
wd = c->cwd; wd = c->cwd;
else if ((s = cmd_current_session(ctx, 0)) != NULL) { else if ((s = cmd_current_session(ctx, 0)) != NULL) {

7
grid.c
View File

@ -511,6 +511,7 @@ grid_string_cells_code(const struct grid_cell *lastgc,
for (i = 0; i < nitems(attrs); i++) { for (i = 0; i < nitems(attrs); i++) {
if (!(attr & attrs[i].mask) && (lastattr & attrs[i].mask)) { if (!(attr & attrs[i].mask) && (lastattr & attrs[i].mask)) {
s[n++] = 0; s[n++] = 0;
lastattr &= GRID_ATTR_CHARSET;
break; break;
} }
} }
@ -523,7 +524,8 @@ grid_string_cells_code(const struct grid_cell *lastgc,
/* If the foreground c changed, append its parameters. */ /* If the foreground c changed, append its parameters. */
nnewc = grid_string_cells_fg(gc, newc); nnewc = grid_string_cells_fg(gc, newc);
noldc = grid_string_cells_fg(lastgc, oldc); noldc = grid_string_cells_fg(lastgc, oldc);
if (nnewc != noldc || memcmp(newc, oldc, nnewc * sizeof newc[0]) != 0) { if (nnewc != noldc ||
memcmp(newc,oldc, nnewc * sizeof newc[0]) != 0) {
for (i = 0; i < nnewc; i++) for (i = 0; i < nnewc; i++)
s[n++] = newc[i]; s[n++] = newc[i];
} }
@ -531,7 +533,8 @@ grid_string_cells_code(const struct grid_cell *lastgc,
/* If the background c changed, append its parameters. */ /* If the background c changed, append its parameters. */
nnewc = grid_string_cells_bg(gc, newc); nnewc = grid_string_cells_bg(gc, newc);
noldc = grid_string_cells_bg(lastgc, oldc); noldc = grid_string_cells_bg(lastgc, oldc);
if (nnewc != noldc || memcmp(newc, oldc, nnewc * sizeof newc[0]) != 0) { if (nnewc != noldc ||
memcmp(newc, oldc, nnewc * sizeof newc[0]) != 0) {
for (i = 0; i < nnewc; i++) for (i = 0; i < nnewc; i++)
s[n++] = newc[i]; s[n++] = newc[i];
} }