summaryrefslogtreecommitdiffstats
path: root/cmd-display-message.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 03:34:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 03:34:56 +0000
commit671f456761fc66649260e831ceee36ec3d4ba9ca (patch)
tree033c56bded071f681e1304311ba0bff449d477cc /cmd-display-message.c
parentAdding debian version 3.3a-5. (diff)
downloadtmux-671f456761fc66649260e831ceee36ec3d4ba9ca.tar.xz
tmux-671f456761fc66649260e831ceee36ec3d4ba9ca.zip
Merging upstream version 3.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmd-display-message.c')
-rw-r--r--cmd-display-message.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/cmd-display-message.c b/cmd-display-message.c
index 7828f69..512509f 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:d:INpt:F:v", 0, 1, NULL },
- .usage = "[-aINpv] [-c target-client] [-d delay] [-F format] "
+ .args = { "ac:d:lINpt:F:v", 0, 1, NULL },
+ .usage = "[-aIlNpv] [-c target-client] [-d delay] [-F format] "
CMD_TARGET_PANE_USAGE " [message]",
.target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL },
@@ -68,9 +68,10 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
struct window_pane *wp = target->wp;
const char *template;
char *msg, *cause;
- int delay = -1, flags;
+ int delay = -1, flags, Nflag = args_has(args, 'N');
struct format_tree *ft;
u_int count = args_count(args);
+ struct evbuffer *evb;
if (args_has(args, 'I')) {
if (wp == NULL)
@@ -132,15 +133,24 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
return (CMD_RETURN_NORMAL);
}
- msg = format_expand_time(ft, template);
+ if (args_has(args, 'l'))
+ msg = xstrdup(template);
+ else
+ msg = format_expand_time(ft, template);
+
if (cmdq_get_client(item) == NULL)
cmdq_error(item, "%s", msg);
else if (args_has(args, 'p'))
cmdq_print(item, "%s", msg);
- else if (tc != NULL) {
- status_message_set(tc, delay, 0, args_has(args, 'N'), "%s",
- msg);
- }
+ else if (tc != NULL && (tc->flags & CLIENT_CONTROL)) {
+ evb = evbuffer_new();
+ if (evb == NULL)
+ fatalx("out of memory");
+ evbuffer_add_printf(evb, "%%message %s", msg);
+ server_client_print(tc, 0, evb);
+ evbuffer_free(evb);
+ } else if (tc != NULL)
+ status_message_set(tc, delay, 0, Nflag, "%s", msg);
free(msg);
format_free(ft);