diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-09-07 18:50:46 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-09-07 18:50:46 +0000 |
commit | a69d6b71f69b12c01a1ed0990c5f18cdb5b27483 (patch) | |
tree | e585fa2a6bbb8d7070e05e0feca593e98fd10564 /usr.bin/tmux/cmd-paste-buffer.c | |
parent | 71bc7869f46d0ba653db9646b6ac592389a99d15 (diff) |
Give each paste buffer a size member instead of requiring them to be
zero-terminated.
Diffstat (limited to 'usr.bin/tmux/cmd-paste-buffer.c')
-rw-r--r-- | usr.bin/tmux/cmd-paste-buffer.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/usr.bin/tmux/cmd-paste-buffer.c b/usr.bin/tmux/cmd-paste-buffer.c index 3e4e24a60c9..f00e7ac38e1 100644 --- a/usr.bin/tmux/cmd-paste-buffer.c +++ b/usr.bin/tmux/cmd-paste-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-paste-buffer.c,v 1.5 2009/07/26 12:58:44 nicm Exp $ */ +/* $OpenBSD: cmd-paste-buffer.c,v 1.6 2009/09/07 18:50:45 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -45,13 +45,13 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_ctx *ctx) { struct cmd_buffer_data *data = self->data; struct winlink *wl; - struct window *w; + struct window_pane *wp; struct session *s; struct paste_buffer *pb; if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL) return (-1); - w = wl->window; + wp = wl->window->active; if (data->buffer == -1) pb = paste_get_top(&s->buffers); @@ -64,13 +64,10 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_ctx *ctx) if (pb != NULL && *pb->data != '\0') { /* -r means raw data without LF->CR conversion. */ - if (data->chflags & CMD_CHFLAG('r')) { - buffer_write( - w->active->out, pb->data, strlen(pb->data)); - } else { - cmd_paste_buffer_lf2cr( - w->active->out, pb->data, strlen(pb->data)); - } + if (data->chflags & CMD_CHFLAG('r')) + buffer_write(wp->out, pb->data, pb->size); + else + cmd_paste_buffer_lf2cr(wp->out, pb->data, pb->size); } /* Delete the buffer if -d. */ |