mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Allow the initial context on prompts to be set with the new -I option to
command-prompt. From Tiago Cunha.
This commit is contained in:
		
							
								
								
									
										19
									
								
								status.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								status.c
									
									
									
									
									
								
							@@ -815,7 +815,7 @@ status_message_redraw(struct client *c)
 | 
			
		||||
 | 
			
		||||
/* Enable status line prompt. */
 | 
			
		||||
void
 | 
			
		||||
status_prompt_set(struct client *c, const char *msg,
 | 
			
		||||
status_prompt_set(struct client *c, const char *msg, const char *input,
 | 
			
		||||
    int (*callbackfn)(void *, const char *), void (*freefn)(void *),
 | 
			
		||||
    void *data, int flags)
 | 
			
		||||
{
 | 
			
		||||
@@ -826,8 +826,11 @@ status_prompt_set(struct client *c, const char *msg,
 | 
			
		||||
 | 
			
		||||
	c->prompt_string = xstrdup(msg);
 | 
			
		||||
 | 
			
		||||
	c->prompt_buffer = xstrdup("");
 | 
			
		||||
	c->prompt_index = 0;
 | 
			
		||||
	if (input != NULL)
 | 
			
		||||
		c->prompt_buffer = xstrdup(input);
 | 
			
		||||
	else
 | 
			
		||||
		c->prompt_buffer = xstrdup("");
 | 
			
		||||
	c->prompt_index = strlen(c->prompt_buffer);
 | 
			
		||||
 | 
			
		||||
	c->prompt_callbackfn = callbackfn;
 | 
			
		||||
	c->prompt_freefn = freefn;
 | 
			
		||||
@@ -871,13 +874,17 @@ status_prompt_clear(struct client *c)
 | 
			
		||||
 | 
			
		||||
/* Update status line prompt with a new prompt string. */
 | 
			
		||||
void
 | 
			
		||||
status_prompt_update(struct client *c, const char *msg)
 | 
			
		||||
status_prompt_update(struct client *c, const char *msg, const char *input)
 | 
			
		||||
{
 | 
			
		||||
	xfree(c->prompt_string);
 | 
			
		||||
	c->prompt_string = xstrdup(msg);
 | 
			
		||||
 | 
			
		||||
	*c->prompt_buffer = '\0';
 | 
			
		||||
	c->prompt_index = 0;
 | 
			
		||||
	xfree(c->prompt_buffer);
 | 
			
		||||
	if (input != NULL)
 | 
			
		||||
		c->prompt_buffer = xstrdup(input);
 | 
			
		||||
	else
 | 
			
		||||
		c->prompt_buffer = xstrdup("");
 | 
			
		||||
	c->prompt_index = strlen(c->prompt_buffer);
 | 
			
		||||
 | 
			
		||||
	c->prompt_hindex = 0;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user