summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-paste-buffer.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-11-04 22:43:12 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-11-04 22:43:12 +0000
commitdfb9b83ba668ae18082113a9efa8908a3c0c304a (patch)
treea0c75dd6f3030ea7c3ce4a622a78a5163d5d8904 /usr.bin/tmux/cmd-paste-buffer.c
parent7c41588f63dd0e0c60b445558f675ed033d96e4d (diff)
Convert the window pane (pty master side) fd over to use a bufferevent.
The evbuffer API is very similar to the existing tmux buffer API so this was remarkably painless. Not many possible ways to do it, I suppose.
Diffstat (limited to 'usr.bin/tmux/cmd-paste-buffer.c')
-rw-r--r--usr.bin/tmux/cmd-paste-buffer.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/usr.bin/tmux/cmd-paste-buffer.c b/usr.bin/tmux/cmd-paste-buffer.c
index f00e7ac38e1..d52f5307f02 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.6 2009/09/07 18:50:45 nicm Exp $ */
+/* $OpenBSD: cmd-paste-buffer.c,v 1.7 2009/11/04 22:43:11 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -27,7 +27,7 @@
*/
int cmd_paste_buffer_exec(struct cmd *, struct cmd_ctx *);
-void cmd_paste_buffer_lf2cr(struct buffer *, const char *, size_t);
+void cmd_paste_buffer_lf2cr(struct window_pane *, const char *, size_t);
const struct cmd_entry cmd_paste_buffer_entry = {
"paste-buffer", "pasteb",
@@ -65,9 +65,9 @@ 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(wp->out, pb->data, pb->size);
+ bufferevent_write(wp->event, pb->data, pb->size);
else
- cmd_paste_buffer_lf2cr(wp->out, pb->data, pb->size);
+ cmd_paste_buffer_lf2cr(wp, pb->data, pb->size);
}
/* Delete the buffer if -d. */
@@ -83,18 +83,18 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
/* Add bytes to a buffer but change every '\n' to '\r'. */
void
-cmd_paste_buffer_lf2cr(struct buffer *b, const char *data, size_t size)
+cmd_paste_buffer_lf2cr(struct window_pane *wp, const char *data, size_t size)
{
const char *end = data + size;
const char *lf;
while ((lf = memchr(data, '\n', end - data)) != NULL) {
if (lf != data)
- buffer_write(b, data, lf - data);
- buffer_write8(b, '\r');
+ bufferevent_write(wp->event, data, lf - data);
+ bufferevent_write(wp->event, "\r", 1);
data = lf + 1;
}
if (end != data)
- buffer_write(b, data, end - data);
+ bufferevent_write(wp->event, data, end - data);
}