diff --git a/cmd-paste-buffer.c b/cmd-paste-buffer.c index 28d4a8cc..bef39593 100644 --- a/cmd-paste-buffer.c +++ b/cmd-paste-buffer.c @@ -55,6 +55,11 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmdq_item *item) size_t seplen, bufsize; int bracket = args_has(args, 'p'); + if (window_pane_exited(wp)) { + cmdq_error(item, "target pane has exited"); + return (CMD_RETURN_ERROR); + } + bufname = NULL; if (args_has(args, 'b')) bufname = args_get(args, 'b'); diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c index bedc8f24..ec6091ed 100644 --- a/cmd-pipe-pane.c +++ b/cmd-pipe-pane.c @@ -69,7 +69,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item) sigset_t set, oldset; /* Do nothing if pane is dead. */ - if (wp->fd == -1 || (wp->flags & PANE_EXITED)) { + if (window_pane_exited(wp)) { cmdq_error(item, "target pane has exited"); return (CMD_RETURN_ERROR); } diff --git a/tmux.h b/tmux.h index 9dd97adc..e6516a72 100644 --- a/tmux.h +++ b/tmux.h @@ -3047,6 +3047,7 @@ int window_pane_key(struct window_pane *, struct client *, struct session *, struct winlink *, key_code, struct mouse_event *); int window_pane_visible(struct window_pane *); +int window_pane_exited(struct window_pane *); u_int window_pane_search(struct window_pane *, const char *, int, int); const char *window_printable_flags(struct winlink *, int); diff --git a/window.c b/window.c index c16dc128..c5d00e29 100644 --- a/window.c +++ b/window.c @@ -1204,6 +1204,12 @@ window_pane_visible(struct window_pane *wp) return (wp == wp->window->active); } +int +window_pane_exited(struct window_pane *wp) +{ + return (wp->fd == -1 || (wp->flags & PANE_EXITED)); +} + u_int window_pane_search(struct window_pane *wp, const char *term, int regex, int ignore)