mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Insert full size panes at the right position, from KOIE Hidetaka in
GitHub issue 1284.
This commit is contained in:
		@@ -64,7 +64,7 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
 | 
				
			|||||||
	const char		*cmd, *path, *shell, *template, *tmp;
 | 
						const char		*cmd, *path, *shell, *template, *tmp;
 | 
				
			||||||
	char		       **argv, *cause, *new_cause, *cp, *cwd;
 | 
						char		       **argv, *cause, *new_cause, *cp, *cwd;
 | 
				
			||||||
	u_int			 hlimit;
 | 
						u_int			 hlimit;
 | 
				
			||||||
	int			 argc, size, percentage;
 | 
						int			 argc, size, percentage, before;
 | 
				
			||||||
	enum layout_type	 type;
 | 
						enum layout_type	 type;
 | 
				
			||||||
	struct layout_cell	*lc;
 | 
						struct layout_cell	*lc;
 | 
				
			||||||
	struct environ_entry	*envent;
 | 
						struct environ_entry	*envent;
 | 
				
			||||||
@@ -96,6 +96,7 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
 | 
				
			|||||||
	type = LAYOUT_TOPBOTTOM;
 | 
						type = LAYOUT_TOPBOTTOM;
 | 
				
			||||||
	if (args_has(args, 'h'))
 | 
						if (args_has(args, 'h'))
 | 
				
			||||||
		type = LAYOUT_LEFTRIGHT;
 | 
							type = LAYOUT_LEFTRIGHT;
 | 
				
			||||||
 | 
						before = args_has(args, 'b');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	size = -1;
 | 
						size = -1;
 | 
				
			||||||
	if (args_has(args, 'l')) {
 | 
						if (args_has(args, 'l')) {
 | 
				
			||||||
@@ -125,13 +126,12 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
 | 
				
			|||||||
	if (*shell == '\0' || areshell(shell))
 | 
						if (*shell == '\0' || areshell(shell))
 | 
				
			||||||
		shell = _PATH_BSHELL;
 | 
							shell = _PATH_BSHELL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	lc = layout_split_pane(wp, type, size, args_has(args, 'b'),
 | 
						lc = layout_split_pane(wp, type, size, before, args_has(args, 'f'));
 | 
				
			||||||
	    args_has(args, 'f'));
 | 
					 | 
				
			||||||
	if (lc == NULL) {
 | 
						if (lc == NULL) {
 | 
				
			||||||
		cause = xstrdup("pane too small");
 | 
							cause = xstrdup("pane too small");
 | 
				
			||||||
		goto error;
 | 
							goto error;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	new_wp = window_add_pane(w, wp, args_has(args, 'b'), hlimit);
 | 
						new_wp = window_add_pane(w, wp, before, args_has(args, 'f'), hlimit);
 | 
				
			||||||
	layout_make_leaf(lc, new_wp);
 | 
						layout_make_leaf(lc, new_wp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	path = NULL;
 | 
						path = NULL;
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								tmux.h
									
									
									
									
									
								
							@@ -2145,7 +2145,7 @@ int		 window_has_pane(struct window *, struct window_pane *);
 | 
				
			|||||||
int		 window_set_active_pane(struct window *, struct window_pane *);
 | 
					int		 window_set_active_pane(struct window *, struct window_pane *);
 | 
				
			||||||
void		 window_redraw_active_switch(struct window *,
 | 
					void		 window_redraw_active_switch(struct window *,
 | 
				
			||||||
		     struct window_pane *);
 | 
							     struct window_pane *);
 | 
				
			||||||
struct window_pane *window_add_pane(struct window *, struct window_pane *,
 | 
					struct window_pane *window_add_pane(struct window *, struct window_pane *, int,
 | 
				
			||||||
		     int, u_int);
 | 
							     int, u_int);
 | 
				
			||||||
void		 window_resize(struct window *, u_int, u_int);
 | 
					void		 window_resize(struct window *, u_int, u_int);
 | 
				
			||||||
int		 window_zoom(struct window_pane *);
 | 
					int		 window_zoom(struct window_pane *);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										14
									
								
								window.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								window.c
									
									
									
									
									
								
							@@ -341,7 +341,7 @@ window_create_spawn(const char *name, int argc, char **argv, const char *path,
 | 
				
			|||||||
	struct window_pane	*wp;
 | 
						struct window_pane	*wp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	w = window_create(sx, sy);
 | 
						w = window_create(sx, sy);
 | 
				
			||||||
	wp = window_add_pane(w, NULL, 0, hlimit);
 | 
						wp = window_add_pane(w, NULL, 0, 0, hlimit);
 | 
				
			||||||
	layout_init(w, wp);
 | 
						layout_init(w, wp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (window_pane_spawn(wp, argc, argv, path, shell, cwd,
 | 
						if (window_pane_spawn(wp, argc, argv, path, shell, cwd,
 | 
				
			||||||
@@ -610,7 +610,7 @@ window_unzoom(struct window *w)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
struct window_pane *
 | 
					struct window_pane *
 | 
				
			||||||
window_add_pane(struct window *w, struct window_pane *other, int before,
 | 
					window_add_pane(struct window *w, struct window_pane *other, int before,
 | 
				
			||||||
    u_int hlimit)
 | 
					    int full_size, u_int hlimit)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct window_pane	*wp;
 | 
						struct window_pane	*wp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -623,10 +623,16 @@ window_add_pane(struct window *w, struct window_pane *other, int before,
 | 
				
			|||||||
		TAILQ_INSERT_HEAD(&w->panes, wp, entry);
 | 
							TAILQ_INSERT_HEAD(&w->panes, wp, entry);
 | 
				
			||||||
	} else if (before) {
 | 
						} else if (before) {
 | 
				
			||||||
		log_debug("%s: @%u before %%%u", __func__, w->id, wp->id);
 | 
							log_debug("%s: @%u before %%%u", __func__, w->id, wp->id);
 | 
				
			||||||
		TAILQ_INSERT_BEFORE(other, wp, entry);
 | 
							if (full_size)
 | 
				
			||||||
 | 
								TAILQ_INSERT_HEAD(&w->panes, wp, entry);
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								TAILQ_INSERT_BEFORE(other, wp, entry);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		log_debug("%s: @%u after %%%u", __func__, w->id, wp->id);
 | 
							log_debug("%s: @%u after %%%u", __func__, w->id, wp->id);
 | 
				
			||||||
		TAILQ_INSERT_AFTER(&w->panes, other, wp, entry);
 | 
							if (full_size)
 | 
				
			||||||
 | 
								TAILQ_INSERT_TAIL(&w->panes, wp, entry);
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								TAILQ_INSERT_AFTER(&w->panes, other, wp, entry);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return (wp);
 | 
						return (wp);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user