mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	send-keys -R should reset the input parser to ground state (so it can be
used to escape from, for example, printf '\033]2;').
This commit is contained in:
		
							
								
								
									
										44
									
								
								input.c
									
									
									
									
									
								
							
							
						
						
									
										44
									
								
								input.c
									
									
									
									
									
								
							@@ -762,24 +762,12 @@ input_init(struct window_pane *wp)
 | 
			
		||||
 | 
			
		||||
	ictx = wp->ictx = xcalloc(1, sizeof *ictx);
 | 
			
		||||
 | 
			
		||||
	input_reset_cell(ictx);
 | 
			
		||||
 | 
			
		||||
	*ictx->interm_buf = '\0';
 | 
			
		||||
	ictx->interm_len = 0;
 | 
			
		||||
 | 
			
		||||
	*ictx->param_buf = '\0';
 | 
			
		||||
	ictx->param_len = 0;
 | 
			
		||||
 | 
			
		||||
	ictx->input_space = INPUT_BUF_START;
 | 
			
		||||
	ictx->input_buf = xmalloc(INPUT_BUF_START);
 | 
			
		||||
 | 
			
		||||
	*ictx->input_buf = '\0';
 | 
			
		||||
	ictx->input_len = 0;
 | 
			
		||||
 | 
			
		||||
	ictx->state = &input_state_ground;
 | 
			
		||||
	ictx->flags = 0;
 | 
			
		||||
 | 
			
		||||
	ictx->since_ground = evbuffer_new();
 | 
			
		||||
 | 
			
		||||
	input_reset(wp, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Destroy input parser. */
 | 
			
		||||
@@ -797,18 +785,32 @@ input_free(struct window_pane *wp)
 | 
			
		||||
 | 
			
		||||
/* Reset input state and clear screen. */
 | 
			
		||||
void
 | 
			
		||||
input_reset(struct window_pane *wp)
 | 
			
		||||
input_reset(struct window_pane *wp, int clear)
 | 
			
		||||
{
 | 
			
		||||
	struct input_ctx	*ictx = wp->ictx;
 | 
			
		||||
 | 
			
		||||
	input_reset_cell(ictx);
 | 
			
		||||
 | 
			
		||||
	if (wp->mode == NULL)
 | 
			
		||||
		screen_write_start(&ictx->ctx, wp, &wp->base);
 | 
			
		||||
	else
 | 
			
		||||
		screen_write_start(&ictx->ctx, NULL, &wp->base);
 | 
			
		||||
	screen_write_reset(&ictx->ctx);
 | 
			
		||||
	screen_write_stop(&ictx->ctx);
 | 
			
		||||
	if (clear) {
 | 
			
		||||
		if (wp->mode == NULL)
 | 
			
		||||
			screen_write_start(&ictx->ctx, wp, &wp->base);
 | 
			
		||||
		else
 | 
			
		||||
			screen_write_start(&ictx->ctx, NULL, &wp->base);
 | 
			
		||||
		screen_write_reset(&ictx->ctx);
 | 
			
		||||
		screen_write_stop(&ictx->ctx);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	*ictx->interm_buf = '\0';
 | 
			
		||||
	ictx->interm_len = 0;
 | 
			
		||||
 | 
			
		||||
	*ictx->param_buf = '\0';
 | 
			
		||||
	ictx->param_len = 0;
 | 
			
		||||
 | 
			
		||||
	*ictx->input_buf = '\0';
 | 
			
		||||
	ictx->input_len = 0;
 | 
			
		||||
 | 
			
		||||
	ictx->state = &input_state_ground;
 | 
			
		||||
	ictx->flags = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Return pending data. */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user