summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2022-11-03 08:33:58 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2022-11-03 08:33:58 +0000
commit4791e66de6af422b537de0af034359ceb1eb0e9a (patch)
treea66646501256eb54ccf66cd17e4a72f9523f6c48
parent4ea7b18f999627dfb1003ba93c46841a25825229 (diff)
Add a -l flag to display-message to disable format expansion, from Aaron
Jensen. GitHub issue 3372.
-rw-r--r--usr.bin/tmux/cmd-display-message.c12
-rw-r--r--usr.bin/tmux/tmux.113
2 files changed, 17 insertions, 8 deletions
diff --git a/usr.bin/tmux/cmd-display-message.c b/usr.bin/tmux/cmd-display-message.c
index b5270b359c6..0b2a734d9d2 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.61 2021/10/07 07:52:13 nicm Exp $ */
+/* $OpenBSD: cmd-display-message.c,v 1.62 2022/11/03 08:33:57 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: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 },
@@ -132,7 +132,11 @@ 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'))
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index 5a2dcada717..75093016613 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.904 2022/10/28 13:00:02 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.905 2022/11/03 08:33:57 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: October 28 2022 $
+.Dd $Mdocdate: November 3 2022 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -5887,7 +5887,7 @@ The following keys are also available:
.El
.Tg display
.It Xo Ic display-message
-.Op Fl aINpv
+.Op Fl aIlNpv
.Op Fl c Ar target-client
.Op Fl d Ar delay
.Op Fl t Ar target-pane
@@ -5909,7 +5909,12 @@ is not given, the
option is used; a delay of zero waits for a key press.
.Ql N
ignores key presses and closes only after the delay expires.
-The format of
+If
+.Fl l
+is given,
+.Ar message
+is printed unchanged.
+Otherwise, the format of
.Ar message
is described in the
.Sx FORMATS