mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Add a format for the last search string in copy mode and fix the prompt
so it can work when in -I, suggested by Suraj N Kurapati.
This commit is contained in:
		
							
								
								
									
										2
									
								
								format.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								format.c
									
									
									
									
									
								
							@@ -1346,6 +1346,8 @@ format_defaults_pane(struct format_tree *ft, struct window_pane *wp)
 | 
			
		||||
	format_add(ft, "pane_in_mode", "%d", wp->screen != &wp->base);
 | 
			
		||||
	format_add(ft, "pane_synchronized", "%d",
 | 
			
		||||
	    !!options_get_number(wp->window->options, "synchronize-panes"));
 | 
			
		||||
	format_add(ft, "pane_search_string", "%s",
 | 
			
		||||
	    window_copy_search_string(wp));
 | 
			
		||||
 | 
			
		||||
	format_add(ft, "pane_tty", "%s", wp->tty);
 | 
			
		||||
	format_add(ft, "pane_pid", "%ld", (long) wp->pid);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								status.c
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								status.c
									
									
									
									
									
								
							@@ -661,7 +661,7 @@ status_prompt_set(struct client *c, const char *msg, const char *input,
 | 
			
		||||
{
 | 
			
		||||
	struct format_tree	*ft;
 | 
			
		||||
	time_t			 t;
 | 
			
		||||
	char			*tmp;
 | 
			
		||||
	char			*tmp, *cp;
 | 
			
		||||
 | 
			
		||||
	ft = format_create(c, NULL, FORMAT_NONE, 0);
 | 
			
		||||
	format_defaults(ft, c, NULL, NULL, NULL);
 | 
			
		||||
@@ -690,6 +690,12 @@ status_prompt_set(struct client *c, const char *msg, const char *input,
 | 
			
		||||
		c->tty.flags |= (TTY_NOCURSOR|TTY_FREEZE);
 | 
			
		||||
	c->flags |= CLIENT_STATUS;
 | 
			
		||||
 | 
			
		||||
	if ((flags & PROMPT_INCREMENTAL) && *tmp != '\0') {
 | 
			
		||||
		xasprintf(&cp, "=%s", tmp);
 | 
			
		||||
		c->prompt_callbackfn(c->prompt_data, cp, 0);
 | 
			
		||||
		free(cp);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	free(tmp);
 | 
			
		||||
	format_free(ft);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								tmux.1
									
									
									
									
									
								
							@@ -3563,6 +3563,7 @@ The following variables are available, where appropriate:
 | 
			
		||||
.It Li "pane_left" Ta "" Ta "Left of pane"
 | 
			
		||||
.It Li "pane_pid" Ta "" Ta "PID of first process in pane"
 | 
			
		||||
.It Li "pane_right" Ta "" Ta "Right of pane"
 | 
			
		||||
.It Li "pane_search_string" Ta "" Ta "Last search string in copy mode"
 | 
			
		||||
.It Li "pane_start_command" Ta "" Ta "Command pane started with"
 | 
			
		||||
.It Li "pane_synchronized" Ta "" Ta "If pane is synchronized"
 | 
			
		||||
.It Li "pane_tabs" Ta "" Ta "Pane tab positions"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								tmux.h
									
									
									
									
									
								
							@@ -2171,6 +2171,7 @@ void		 window_copy_vadd(struct window_pane *, const char *, va_list);
 | 
			
		||||
void		 window_copy_pageup(struct window_pane *, int);
 | 
			
		||||
void		 window_copy_start_drag(struct client *, struct mouse_event *);
 | 
			
		||||
int		 window_copy_scroll_position(struct window_pane *);
 | 
			
		||||
const char	*window_copy_search_string(struct window_pane *);
 | 
			
		||||
 | 
			
		||||
/* window-choose.c */
 | 
			
		||||
extern const struct window_mode window_choose_mode;
 | 
			
		||||
 
 | 
			
		||||
@@ -2480,3 +2480,16 @@ window_copy_drag_update(__unused struct client *c, struct mouse_event *m)
 | 
			
		||||
	if (window_copy_update_selection(wp, 1))
 | 
			
		||||
		window_copy_redraw_selection(wp, old_cy);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char *
 | 
			
		||||
window_copy_search_string(struct window_pane *wp)
 | 
			
		||||
{
 | 
			
		||||
	struct window_copy_mode_data	*data;
 | 
			
		||||
 | 
			
		||||
	if (wp->mode != &window_copy_mode)
 | 
			
		||||
		return ("");
 | 
			
		||||
	data = wp->modedata;
 | 
			
		||||
	if (data->searchtype == WINDOW_COPY_OFF || data->searchstr == NULL)
 | 
			
		||||
		return ("");
 | 
			
		||||
	return (data->searchstr);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user