mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-03 17:24:18 +00:00 
			
		
		
		
	Add a format for the name of the pane's mode, lets it be used as a
conditional for key bindings.
This commit is contained in:
		
							
								
								
									
										3
									
								
								format.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								format.c
									
									
									
									
									
								
							@@ -1371,6 +1371,9 @@ format_defaults_pane(struct format_tree *ft, struct window_pane *wp)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	format_add(ft, "pane_in_mode", "%d", wp->screen != &wp->base);
 | 
			
		||||
	if (wp->mode != NULL)
 | 
			
		||||
		format_add(ft, "pane_mode", "%s", wp->mode->name);
 | 
			
		||||
 | 
			
		||||
	format_add(ft, "pane_synchronized", "%d",
 | 
			
		||||
	    !!options_get_number(wp->window->options, "synchronize-panes"));
 | 
			
		||||
	format_add(ft, "pane_search_string", "%s",
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								tmux.1
									
									
									
									
									
								
							@@ -3561,6 +3561,7 @@ The following variables are available, where appropriate:
 | 
			
		||||
.It Li "pane_input_off" Ta "" Ta "If input to pane is disabled"
 | 
			
		||||
.It Li "pane_index" Ta "#P" Ta "Index of pane"
 | 
			
		||||
.It Li "pane_left" Ta "" Ta "Left of pane"
 | 
			
		||||
.It Li "pane_mode" Ta "" Ta "Name of pane mode, if any."
 | 
			
		||||
.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"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										9
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								tmux.h
									
									
									
									
									
								
							@@ -689,15 +689,18 @@ struct screen_write_ctx {
 | 
			
		||||
 * right function to handle input and output.
 | 
			
		||||
 */
 | 
			
		||||
struct window_mode {
 | 
			
		||||
	const char	*name;
 | 
			
		||||
 | 
			
		||||
	struct screen	*(*init)(struct window_pane *);
 | 
			
		||||
	void		 (*free)(struct window_pane *);
 | 
			
		||||
	void		 (*resize)(struct window_pane *, u_int, u_int);
 | 
			
		||||
	void	(*key)(struct window_pane *, struct client *, struct session *,
 | 
			
		||||
		    key_code, struct mouse_event *);
 | 
			
		||||
	void		 (*key)(struct window_pane *, struct client *,
 | 
			
		||||
			     struct session *, key_code, struct mouse_event *);
 | 
			
		||||
 | 
			
		||||
	const char	*(*key_table)(struct window_pane *);
 | 
			
		||||
	void		 (*command)(struct window_pane *, struct client *,
 | 
			
		||||
		    struct session *, struct args *, struct mouse_event *);
 | 
			
		||||
			     struct session *, struct args *,
 | 
			
		||||
			     struct mouse_event *);
 | 
			
		||||
};
 | 
			
		||||
#define WINDOW_MODE_TIMEOUT 180
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -57,6 +57,8 @@ enum window_choose_input_type {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const struct window_mode window_choose_mode = {
 | 
			
		||||
	.name = "choose-mode",
 | 
			
		||||
 | 
			
		||||
	.init = window_choose_init,
 | 
			
		||||
	.free = window_choose_free,
 | 
			
		||||
	.resize = window_choose_resize,
 | 
			
		||||
 
 | 
			
		||||
@@ -34,6 +34,8 @@ static void	window_clock_timer_callback(int, short, void *);
 | 
			
		||||
static void	window_clock_draw_screen(struct window_pane *);
 | 
			
		||||
 | 
			
		||||
const struct window_mode window_clock_mode = {
 | 
			
		||||
	.name = "clock-mode",
 | 
			
		||||
 | 
			
		||||
	.init = window_clock_init,
 | 
			
		||||
	.free = window_clock_free,
 | 
			
		||||
	.resize = window_clock_resize,
 | 
			
		||||
 
 | 
			
		||||
@@ -105,6 +105,8 @@ static void	window_copy_move_mouse(struct mouse_event *);
 | 
			
		||||
static void	window_copy_drag_update(struct client *, struct mouse_event *);
 | 
			
		||||
 | 
			
		||||
const struct window_mode window_copy_mode = {
 | 
			
		||||
	.name = "copy-mode",
 | 
			
		||||
 | 
			
		||||
	.init = window_copy_init,
 | 
			
		||||
	.free = window_copy_free,
 | 
			
		||||
	.resize = window_copy_resize,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user