diff options
author | 2020-04-13 20:51:57 +0000 | |
---|---|---|
committer | 2020-04-13 20:51:57 +0000 | |
commit | 035dc73d1aa2b06694f1c8fe08a74fa3650b6b4b (patch) | |
tree | 8f02eaf34f310252f3d53b5b224f63392f0b7810 /usr.bin/tmux/cmd-display-message.c | |
parent | Try to send a DELETE message if the SA is reset with 'ikectl reset id'. (diff) | |
download | wireguard-openbsd-035dc73d1aa2b06694f1c8fe08a74fa3650b6b4b.tar.xz wireguard-openbsd-035dc73d1aa2b06694f1c8fe08a74fa3650b6b4b.zip |
Make client -c and -t handling common in cmd-queue.c and try to be
clearer about whether the client is the target client (must have a
session) or not.
Diffstat (limited to 'usr.bin/tmux/cmd-display-message.c')
-rw-r--r-- | usr.bin/tmux/cmd-display-message.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/usr.bin/tmux/cmd-display-message.c b/usr.bin/tmux/cmd-display-message.c index f4f32ed7dda..f3e6900239b 100644 --- a/usr.bin/tmux/cmd-display-message.c +++ b/usr.bin/tmux/cmd-display-message.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-display-message.c,v 1.52 2020/04/13 10:59:58 nicm Exp $ */ +/* $OpenBSD: cmd-display-message.c,v 1.53 2020/04/13 20:51:57 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -45,7 +45,7 @@ const struct cmd_entry cmd_display_message_entry = { .target = { 't', CMD_FIND_PANE, 0 }, - .flags = CMD_AFTERHOOK, + .flags = CMD_AFTERHOOK|CMD_CLIENT_CFLAG|CMD_CLIENT_CANFAIL, .exec = cmd_display_message_exec }; @@ -62,7 +62,7 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item) { struct args *args = cmd_get_args(self); struct cmd_find_state *target = cmdq_get_target(item); - struct client *c, *target_c; + struct client *tc = cmdq_get_target_client(item), *c; struct session *s = target->s; struct winlink *wl = target->wl; struct window_pane *wp = target->wp; @@ -97,17 +97,16 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item) * formats too, assuming it matches the session. If it doesn't, use the * best client for the session. */ - c = cmd_find_client(item, args_get(args, 'c'), 1); - if (c != NULL && c->session == s) - target_c = c; + if (tc != NULL && tc->session == s) + c = tc; else - target_c = cmd_find_best_client(s); + c = cmd_find_best_client(s); if (args_has(args, 'v')) flags = FORMAT_VERBOSE; else flags = 0; ft = format_create(cmdq_get_client(item), item, FORMAT_NONE, flags); - format_defaults(ft, target_c, s, wl, wp); + format_defaults(ft, c, s, wl, wp); if (args_has(args, 'a')) { format_each(ft, cmd_display_message_each, item); @@ -117,8 +116,8 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item) msg = format_expand_time(ft, template); if (args_has(args, 'p')) cmdq_print(item, "%s", msg); - else if (c != NULL) - status_message_set(c, "%s", msg); + else if (tc != NULL) + status_message_set(tc, "%s", msg); free(msg); format_free(ft); |