From 1292540bb53542ed66890d60f076cc401386b26d Mon Sep 17 00:00:00 2001 From: Tiago Cunha Date: Thu, 20 Aug 2009 11:51:20 +0000 Subject: Sync OpenBSD patchset 276: Extend command-prompt with a -p option which is a comma-separated list of one or more prompts to present in order. The responses to the prompt are replaced in the template string: %% are replaced in order, so the first prompt replaces the first %%, the second replaces the second, and so on. In addition, %1 up to %9 are replaced with the responses to the first the ninth prompts The default template is "%1" so the response to the first prompt is processed as a command. Note that this changes the behaviour for %% so if there is only one prompt, only the first %% will be replaced. Templates such as "neww -n '%%' 'ssh %%'" should be changed to "neww -n '%1' 'ssh %1'". From Tiago Cunha. --- status.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'status.c') diff --git a/status.c b/status.c index 17122f52..0a792f39 100644 --- a/status.c +++ b/status.c @@ -1,4 +1,4 @@ -/* $Id: status.c,v 1.111 2009-08-20 11:22:47 tcunha Exp $ */ +/* $Id: status.c,v 1.112 2009-08-20 11:51:20 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -668,6 +668,20 @@ status_prompt_clear(struct client *c) screen_reinit(&c->status); } +void +status_prompt_update(struct client *c, const char *msg) +{ + xfree(c->prompt_string); + c->prompt_string = xstrdup(msg); + + *c->prompt_buffer = '\0'; + c->prompt_index = 0; + + c->prompt_hindex = 0; + + c->flags |= CLIENT_STATUS; +} + /* Draw client prompt on status line of present else on last line. */ int status_prompt_redraw(struct client *c) -- cgit