aboutsummaryrefslogtreecommitdiff
path: root/cmd-display-message.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2011-04-06 22:21:02 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2011-04-06 22:21:02 +0000
commitffce6b34b2da3b78fd0cfae9e031a54027d7f7a7 (patch)
treee8cd25db87cbec15471705f039cf7cafe3f1fada /cmd-display-message.c
parent108fb38cbc23fe2be642dc2acc62d7d4e059b01a (diff)
downloadrtmux-ffce6b34b2da3b78fd0cfae9e031a54027d7f7a7.tar.gz
rtmux-ffce6b34b2da3b78fd0cfae9e031a54027d7f7a7.tar.bz2
rtmux-ffce6b34b2da3b78fd0cfae9e031a54027d7f7a7.zip
|PatchSet 876
|Date: 2011/03/29 20:30:16 |Author: nicm |Branch: HEAD |Tag: (none) |Log: |Change -t on display-message to be target-pane for the #[A-Z] |replacements and add -c as target-client.
Diffstat (limited to 'cmd-display-message.c')
-rw-r--r--cmd-display-message.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/cmd-display-message.c b/cmd-display-message.c
index 2d082c76..e3327363 100644
--- a/cmd-display-message.c
+++ b/cmd-display-message.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-display-message.c,v 1.8 2011-01-07 14:45:34 tcunha Exp $ */
+/* $Id: cmd-display-message.c,v 1.9 2011-04-06 22:21:02 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -30,8 +30,8 @@ int cmd_display_message_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_display_message_entry = {
"display-message", "display",
- "pt:", 0, 1,
- "[-p] " CMD_TARGET_CLIENT_USAGE " [message]",
+ "c:pt:", 0, 1,
+ "[-p] [-c target-client] [-t target-pane] [message]",
0,
NULL,
NULL,
@@ -43,18 +43,31 @@ cmd_display_message_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct args *args = self->args;
struct client *c;
+ struct session *s;
+ struct winlink *wl;
+ struct window_pane *wp;
const char *template;
char *msg;
- if ((c = cmd_find_client(ctx, args_get(args, 't'))) == NULL)
+ if ((c = cmd_find_client(ctx, args_get(args, 'c'))) == NULL)
return (-1);
+ if (args_has(args, 't') != NULL) {
+ wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp);
+ if (wl == NULL)
+ return (-1);
+ } else {
+ s = NULL;
+ wl = NULL;
+ wp = NULL;
+ }
+
if (args->argc == 0)
template = "[#S] #I:#W, current pane #P - (%H:%M %d-%b-%y)";
else
template = args->argv[0];
- msg = status_replace(c, NULL, template, time(NULL), 0);
+ msg = status_replace(c, s, wl, wp, template, time(NULL), 0);
if (args_has(self->args, 'p'))
ctx->print(ctx, "%s", msg);
else