diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-11-08 23:02:56 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-11-08 23:02:56 +0000 |
commit | 2df08827223872cd6b3ac1df527e55c2275a08cc (patch) | |
tree | fb8469066812b92a57e837a1c9b8e338a8968071 /cmd-paste-buffer.c | |
parent | 70b2f1981e76794f0de84427df733fc2e5eb5242 (diff) |
Sync OpenBSD patchset 498:
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 'cmd-paste-buffer.c')
-rw-r--r-- | cmd-paste-buffer.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/cmd-paste-buffer.c b/cmd-paste-buffer.c index 325a41aa..37213f26 100644 --- a/cmd-paste-buffer.c +++ b/cmd-paste-buffer.c @@ -1,4 +1,4 @@ -/* $Id: cmd-paste-buffer.c,v 1.20 2009-09-07 23:48:54 tcunha Exp $ */ +/* $Id: cmd-paste-buffer.c,v 1.21 2009-11-08 23:02:56 tcunha 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); } |