summaryrefslogtreecommitdiffstats
path: root/cmd-display-message.c
diff options
context:
space:
mode:
authornicm <nicm>2019-05-03 20:44:24 +0000
committernicm <nicm>2019-05-03 20:44:24 +0000
commit9f75635596d0a01282156eb9e17fde6f4205c05c (patch)
treec2992361a46c5ed7a17c2f273d3e8aba5bc16480 /cmd-display-message.c
parente8e4f4ec3e4de0bd0e4eb2a7ee995fb6f5f7f937 (diff)
Allow panes to be empty (no command), output can be piped to them with
split-window or display-message -I.
Diffstat (limited to 'cmd-display-message.c')
-rw-r--r--cmd-display-message.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/cmd-display-message.c b/cmd-display-message.c
index 2e935908..8c1ad5f6 100644
--- a/cmd-display-message.c
+++ b/cmd-display-message.c
@@ -39,8 +39,8 @@ const struct cmd_entry cmd_display_message_entry = {
.name = "display-message",
.alias = "display",
- .args = { "ac:pt:F:v", 0, 1 },
- .usage = "[-apv] [-c target-client] [-F format] "
+ .args = { "ac:Ipt:F:v", 0, 1 },
+ .usage = "[-aIpv] [-c target-client] [-F format] "
CMD_TARGET_PANE_USAGE " [message]",
.target = { 't', CMD_FIND_PANE, 0 },
@@ -66,10 +66,19 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
struct winlink *wl = item->target.wl;
struct window_pane *wp = item->target.wp;
const char *template;
- char *msg;
+ char *msg, *cause;
struct format_tree *ft;
int flags;
+ if (args_has(args, 'I')) {
+ if (window_pane_start_input(wp, item, &cause) != 0) {
+ cmdq_error(item, "%s", cause);
+ free(cause);
+ return (CMD_RETURN_ERROR);
+ }
+ return (CMD_RETURN_WAIT);
+ }
+
if (args_has(args, 'F') && args->argc != 0) {
cmdq_error(item, "only one of -F or argument must be given");
return (CMD_RETURN_ERROR);