From 10a44e263ade86f46a7b33290341df8080347b40 Mon Sep 17 00:00:00 2001 From: Michael Grant Date: Fri, 18 Sep 2026 23:59:01 +0100 Subject: [PATCH] =?UTF-8?q?Add=20display-message=20-c=20target-client,=20w?= =?UTF-8?q?hich=20causes=20the=20=E2=80=98#{client=5F*}=E2=80=99=20variabl?= =?UTF-8?q?es=20to=20be=20taken=20from=20target-client.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd-display-message.c | 12 ++++++++---- tmux.1 | 8 +++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/cmd-display-message.c b/cmd-display-message.c index 0e294ef50..4c29248a1 100644 --- a/cmd-display-message.c +++ b/cmd-display-message.c @@ -115,11 +115,15 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item) /* * -c is intended to be the client where the message should be - * displayed if -p is not given. But it makes sense to use it for the - * formats too, assuming it matches the session. If it doesn't, use the - * best client for the session. + * displayed if -p is not given, but it makes sense to use it for the + * client formats too. If it was given explicitly, use it even when it + * is not in the target session, since the formats should describe the + * client which was asked for; the session, window and pane formats + * still come from the target. Otherwise it is just the current client, + * so only use it if it matches the session and fall back to the best + * client for the session if not. */ - if (tc != NULL && tc->session == s) + if (tc != NULL && (args_has(args, 'c') || tc->session == s)) c = tc; else if (s != NULL) c = cmd_find_best_client(s); diff --git a/tmux.1 b/tmux.1 index 56790f9f0..3a1bae73f 100644 --- a/tmux.1 +++ b/tmux.1 @@ -8328,11 +8328,17 @@ Otherwise, the format of .Ar message is described in the .Sx FORMATS -section; information is taken from +section; session, window and pane information is taken from .Ar target\-pane if .Fl t is given, otherwise the active pane. +If +.Fl c +is given, the +.Ql #{client_*} +variables are taken from +.Ar target\-client . .Pp If .Fl j