summaryrefslogtreecommitdiffstats
path: root/cmd-pipe-pane.c
diff options
context:
space:
mode:
authornicm <nicm>2020-05-21 07:24:13 +0000
committernicm <nicm>2020-05-21 07:24:13 +0000
commit31e3f2d530090793815d145a16a1ce3b469c4266 (patch)
treecdca6cd9bcf0eea85d61053f1bb4aa2d2d1c81a7 /cmd-pipe-pane.c
parent6bde1c183766d0637633c1460cf6b17b57bc0280 (diff)
Support code for control mode flow control: allow clients to have
separate offsets (used and acknowleged) into the pane buffers; turn off reading from panes when no clients can accept the data; and add a -A flag to refresh-client to let clients turn receiving a pane on and off.
Diffstat (limited to 'cmd-pipe-pane.c')
-rw-r--r--cmd-pipe-pane.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c
index 185bdc12..d9d9f436 100644
--- a/cmd-pipe-pane.c
+++ b/cmd-pipe-pane.c
@@ -56,16 +56,17 @@ const struct cmd_entry cmd_pipe_pane_entry = {
static enum cmd_retval
cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item)
{
- struct args *args = cmd_get_args(self);
- struct cmd_find_state *target = cmdq_get_target(item);
- struct client *tc = cmdq_get_target_client(item);
- struct window_pane *wp = target->wp;
- struct session *s = target->s;
- struct winlink *wl = target->wl;
- char *cmd;
- int old_fd, pipe_fd[2], null_fd, in, out;
- struct format_tree *ft;
- sigset_t set, oldset;
+ struct args *args = cmd_get_args(self);
+ struct cmd_find_state *target = cmdq_get_target(item);
+ struct client *tc = cmdq_get_target_client(item);
+ struct window_pane *wp = target->wp;
+ struct session *s = target->s;
+ struct winlink *wl = target->wl;
+ struct window_pane_offset *wpo = &wp->pipe_offset;
+ char *cmd;
+ int old_fd, pipe_fd[2], null_fd, in, out;
+ struct format_tree *ft;
+ sigset_t set, oldset;
/* Destroy the old pipe. */
old_fd = wp->pipe_fd;
@@ -159,10 +160,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item)
close(pipe_fd[1]);
wp->pipe_fd = pipe_fd[0];
- if (wp->fd != -1)
- wp->pipe_off = EVBUFFER_LENGTH(wp->event->input);
- else
- wp->pipe_off = 0;
+ memcpy(wpo, &wp->offset, sizeof *wpo);
setblocking(wp->pipe_fd, 0);
wp->pipe_event = bufferevent_new(wp->pipe_fd,