mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Add formats for when window is larger than client, and show offset in
status-right by default when larger.
This commit is contained in:
		
							
								
								
									
										18
									
								
								format.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								format.c
									
									
									
									
									
								
							@@ -106,9 +106,10 @@ struct format_entry {
 | 
			
		||||
 | 
			
		||||
/* Format entry tree. */
 | 
			
		||||
struct format_tree {
 | 
			
		||||
	struct window		*w;
 | 
			
		||||
	struct winlink		*wl;
 | 
			
		||||
	struct client		*c;
 | 
			
		||||
	struct session		*s;
 | 
			
		||||
	struct winlink		*wl;
 | 
			
		||||
	struct window		*w;
 | 
			
		||||
	struct window_pane	*wp;
 | 
			
		||||
 | 
			
		||||
	struct client		*client;
 | 
			
		||||
@@ -1395,6 +1396,7 @@ format_defaults_client(struct format_tree *ft, struct client *c)
 | 
			
		||||
 | 
			
		||||
	if (ft->s == NULL)
 | 
			
		||||
		ft->s = c->session;
 | 
			
		||||
	ft->c = c;
 | 
			
		||||
 | 
			
		||||
	format_add(ft, "client_name", "%s", c->name);
 | 
			
		||||
	format_add(ft, "client_pid", "%ld", (long) c->pid);
 | 
			
		||||
@@ -1463,8 +1465,11 @@ format_defaults_window(struct format_tree *ft, struct window *w)
 | 
			
		||||
static void
 | 
			
		||||
format_defaults_winlink(struct format_tree *ft, struct winlink *wl)
 | 
			
		||||
{
 | 
			
		||||
	struct client	*c = ft->c;
 | 
			
		||||
	struct session	*s = wl->session;
 | 
			
		||||
	struct window	*w = wl->window;
 | 
			
		||||
	int		 flag;
 | 
			
		||||
	u_int		 ox, oy, sx, sy;
 | 
			
		||||
 | 
			
		||||
	if (ft->w == NULL)
 | 
			
		||||
		ft->w = wl->window;
 | 
			
		||||
@@ -1472,6 +1477,15 @@ format_defaults_winlink(struct format_tree *ft, struct winlink *wl)
 | 
			
		||||
 | 
			
		||||
	format_defaults_window(ft, w);
 | 
			
		||||
 | 
			
		||||
	if (c != NULL) {
 | 
			
		||||
		flag = tty_window_offset(&c->tty, &ox, &oy, &sx, &sy);
 | 
			
		||||
		format_add(ft, "window_bigger", "%d", flag);
 | 
			
		||||
		if (flag) {
 | 
			
		||||
			format_add(ft, "window_offset_x", "%u", ox);
 | 
			
		||||
			format_add(ft, "window_offset_y", "%u", oy);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	format_add(ft, "window_index", "%d", wl->idx);
 | 
			
		||||
	format_add_cb(ft, "window_stack_index", format_cb_window_stack_index);
 | 
			
		||||
	format_add(ft, "window_flags", "%s", window_printable_flags(wl));
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user