From 6022e44ffbe0e648b515461b5897f28bdcafb0b0 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 29 May 2017 20:42:54 +0000 Subject: Add a flag to stop the prompt input being expanded. --- usr.bin/tmux/status.c | 11 ++++++++--- usr.bin/tmux/tmux.h | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c index 2021385ad11..8e90f52c721 100644 --- a/usr.bin/tmux/status.c +++ b/usr.bin/tmux/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.167 2017/05/29 20:41:29 nicm Exp $ */ +/* $OpenBSD: status.c,v 1.168 2017/05/29 20:42:53 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -677,9 +677,14 @@ status_prompt_set(struct client *c, const char *msg, const char *input, ft = format_create(c, NULL, FORMAT_NONE, 0); format_defaults(ft, c, NULL, NULL, NULL); - t = time(NULL); - tmp = format_expand_time(ft, input, t); + + if (input == NULL) + input = ""; + if (flags & PROMPT_NOFORMAT) + tmp = xstrdup(input); + else + tmp = format_expand_time(ft, input, t); status_message_clear(c); status_prompt_clear(c); diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index c80806506cf..11e0ff55054 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.773 2017/05/29 20:41:29 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.774 2017/05/29 20:42:53 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1378,6 +1378,7 @@ struct client { #define PROMPT_SINGLE 0x1 #define PROMPT_NUMERIC 0x2 #define PROMPT_INCREMENTAL 0x4 +#define PROMPT_NOFORMAT 0x8 int prompt_flags; struct session *session; -- cgit v1.2.3