summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-display-message.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2020-07-27 08:03:10 +0000
committernicm <nicm@openbsd.org>2020-07-27 08:03:10 +0000
commit247fdabff8519f7d585994f6c13c3381b7ef3241 (patch)
treea00cdd8389647e771bd50951762373377326b2ca /usr.bin/tmux/cmd-display-message.c
parenttrim trailing whitespace in if_iwn.c (diff)
downloadwireguard-openbsd-247fdabff8519f7d585994f6c13c3381b7ef3241.tar.xz
wireguard-openbsd-247fdabff8519f7d585994f6c13c3381b7ef3241.zip
Add a -d option to display-message to set delay, from theonekeyg at
gmail dot com in GitHub issue 2322.
Diffstat (limited to 'usr.bin/tmux/cmd-display-message.c')
-rw-r--r--usr.bin/tmux/cmd-display-message.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/usr.bin/tmux/cmd-display-message.c b/usr.bin/tmux/cmd-display-message.c
index bca113f3ef3..5a0b2850097 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.54 2020/05/16 15:54:20 nicm Exp $ */
+/* $OpenBSD: cmd-display-message.c,v 1.55 2020/07/27 08:03:10 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -39,8 +39,8 @@ const struct cmd_entry cmd_display_message_entry = {
.name = "display-message",
.alias = "display",
- .args = { "ac:Ipt:F:v", 0, 1 },
- .usage = "[-aIpv] [-c target-client] [-F format] "
+ .args = { "acd:Ipt:F:v", 0, 1 },
+ .usage = "[-aIpv] [-c target-client] [-d delay] [-F format] "
CMD_TARGET_PANE_USAGE " [message]",
.target = { 't', CMD_FIND_PANE, 0 },
@@ -68,6 +68,7 @@ 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;
struct format_tree *ft;
int flags;
@@ -85,6 +86,15 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
return (CMD_RETURN_ERROR);
}
+ if (args_has(args, 'd')) {
+ delay = args_strtonum(args, 'd', 0, UINT_MAX, &cause);
+ if (cause != NULL) {
+ cmdq_error(item, "delay %s", cause);
+ free(cause);
+ return (CMD_RETURN_ERROR);
+ }
+ }
+
template = args_get(args, 'F');
if (args->argc != 0)
template = args->argv[0];
@@ -117,7 +127,7 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
if (args_has(args, 'p'))
cmdq_print(item, "%s", msg);
else if (tc != NULL)
- status_message_set(tc, 0, "%s", msg);
+ status_message_set(tc, delay, 0, "%s", msg);
free(msg);
format_free(ft);