mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Sync OpenBSD patchset 600:
Change split-window to accept a pane target (it should be split-pane but renaming the command would be annoying).
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: cmd-split-window.c,v 1.31 2009-12-04 22:14:47 tcunha Exp $ */
 | 
					/* $Id: cmd-split-window.c,v 1.32 2010-01-08 16:23:38 tcunha Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -44,7 +44,7 @@ struct cmd_split_window_data {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const struct cmd_entry cmd_split_window_entry = {
 | 
					const struct cmd_entry cmd_split_window_entry = {
 | 
				
			||||||
	"split-window", "splitw",
 | 
						"split-window", "splitw",
 | 
				
			||||||
	"[-dhv] [-p percentage|-l size] [-t target-window] [command]",
 | 
						"[-dhv] [-p percentage|-l size] [-t target-pane] [command]",
 | 
				
			||||||
	0, "",
 | 
						0, "",
 | 
				
			||||||
	cmd_split_window_init,
 | 
						cmd_split_window_init,
 | 
				
			||||||
	cmd_split_window_parse,
 | 
						cmd_split_window_parse,
 | 
				
			||||||
@@ -148,7 +148,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
				
			|||||||
	struct session			*s;
 | 
						struct session			*s;
 | 
				
			||||||
	struct winlink			*wl;
 | 
						struct winlink			*wl;
 | 
				
			||||||
	struct window			*w;
 | 
						struct window			*w;
 | 
				
			||||||
	struct window_pane		*wp;
 | 
						struct window_pane		*wp, *new_wp;
 | 
				
			||||||
	struct environ			 env;
 | 
						struct environ			 env;
 | 
				
			||||||
	char		 		*cmd, *cwd, *cause;
 | 
						char		 		*cmd, *cwd, *cause;
 | 
				
			||||||
	const char			*shell;
 | 
						const char			*shell;
 | 
				
			||||||
@@ -156,7 +156,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
				
			|||||||
	int				 size;
 | 
						int				 size;
 | 
				
			||||||
	enum layout_type		 type;
 | 
						enum layout_type		 type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL)
 | 
						if ((wl = cmd_find_pane(ctx, data->target, &s, &wp)) == NULL)
 | 
				
			||||||
		return (-1);
 | 
							return (-1);
 | 
				
			||||||
	w = wl->window;
 | 
						w = wl->window;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -192,10 +192,10 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
				
			|||||||
	if (*shell == '\0' || areshell(shell))
 | 
						if (*shell == '\0' || areshell(shell))
 | 
				
			||||||
		shell = _PATH_BSHELL;
 | 
							shell = _PATH_BSHELL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wp = window_add_pane(w, hlimit);
 | 
						new_wp = window_add_pane(w, hlimit);
 | 
				
			||||||
	if (window_pane_spawn(wp, cmd, shell, cwd, &env, s->tio, &cause) != 0)
 | 
						if (window_pane_spawn(new_wp, cmd, shell, cwd, &env, s->tio, &cause) != 0)
 | 
				
			||||||
		goto error;
 | 
							goto error;
 | 
				
			||||||
	if (layout_split_pane(w->active, type, size, wp) != 0) {
 | 
						if (layout_split_pane(wp, type, size, new_wp) != 0) {
 | 
				
			||||||
		cause = xstrdup("pane too small");
 | 
							cause = xstrdup("pane too small");
 | 
				
			||||||
		goto error;
 | 
							goto error;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -203,7 +203,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
				
			|||||||
	server_redraw_window(w);
 | 
						server_redraw_window(w);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!data->flag_detached) {
 | 
						if (!data->flag_detached) {
 | 
				
			||||||
		window_set_active_pane(w, wp);
 | 
							window_set_active_pane(w, new_wp);
 | 
				
			||||||
		session_select(s, wl->idx);
 | 
							session_select(s, wl->idx);
 | 
				
			||||||
		server_redraw_session(s);
 | 
							server_redraw_session(s);
 | 
				
			||||||
	} else
 | 
						} else
 | 
				
			||||||
@@ -214,8 +214,8 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
error:
 | 
					error:
 | 
				
			||||||
	environ_free(&env);
 | 
						environ_free(&env);
 | 
				
			||||||
	if (wp != NULL)
 | 
						if (new_wp != NULL)
 | 
				
			||||||
		window_remove_pane(w, wp);
 | 
							window_remove_pane(w, new_wp);
 | 
				
			||||||
	ctx->error(ctx, "create pane failed: %s", cause);
 | 
						ctx->error(ctx, "create pane failed: %s", cause);
 | 
				
			||||||
	xfree(cause);
 | 
						xfree(cause);
 | 
				
			||||||
	return (-1);
 | 
						return (-1);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										13
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								tmux.1
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
.\" $Id: tmux.1,v 1.217 2010-01-05 23:52:37 tcunha Exp $
 | 
					.\" $Id: tmux.1,v 1.218 2010-01-08 16:23:38 tcunha Exp $
 | 
				
			||||||
.\"
 | 
					.\"
 | 
				
			||||||
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
.\"
 | 
					.\"
 | 
				
			||||||
@@ -14,7 +14,7 @@
 | 
				
			|||||||
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 | 
					.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 | 
				
			||||||
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
					.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
.\"
 | 
					.\"
 | 
				
			||||||
.Dd $Mdocdate: January 3 2010 $
 | 
					.Dd $Mdocdate: January 7 2010 $
 | 
				
			||||||
.Dt TMUX 1
 | 
					.Dt TMUX 1
 | 
				
			||||||
.Os
 | 
					.Os
 | 
				
			||||||
.Sh NAME
 | 
					.Sh NAME
 | 
				
			||||||
@@ -984,11 +984,12 @@ Select the window at
 | 
				
			|||||||
.Oo Fl l
 | 
					.Oo Fl l
 | 
				
			||||||
.Ar size |
 | 
					.Ar size |
 | 
				
			||||||
.Fl p Ar percentage Oc
 | 
					.Fl p Ar percentage Oc
 | 
				
			||||||
.Op Fl t Ar target-window
 | 
					.Op Fl t Ar target-pane
 | 
				
			||||||
.Op Ar command
 | 
					.Op Ar command
 | 
				
			||||||
.Xc
 | 
					.Xc
 | 
				
			||||||
.D1 (alias: splitw )
 | 
					.D1 (alias: splitw )
 | 
				
			||||||
Creates a new pane by splitting the active pane:
 | 
					Create a new pane by splitting
 | 
				
			||||||
 | 
					.Ar target-pane :
 | 
				
			||||||
.Fl h
 | 
					.Fl h
 | 
				
			||||||
does a horizontal split and
 | 
					does a horizontal split and
 | 
				
			||||||
.Fl v
 | 
					.Fl v
 | 
				
			||||||
@@ -999,9 +1000,9 @@ The
 | 
				
			|||||||
.Fl l
 | 
					.Fl l
 | 
				
			||||||
and
 | 
					and
 | 
				
			||||||
.Fl p
 | 
					.Fl p
 | 
				
			||||||
options specify the size of the new window in lines (for vertical split) or in
 | 
					options specify the size of the new pane in lines (for vertical split) or in
 | 
				
			||||||
cells (for horizontal split), or as a percentage, respectively.
 | 
					cells (for horizontal split), or as a percentage, respectively.
 | 
				
			||||||
All other options have the same meaning as in the
 | 
					All other options have the same meaning as for the
 | 
				
			||||||
.Ic new-window
 | 
					.Ic new-window
 | 
				
			||||||
command.
 | 
					command.
 | 
				
			||||||
.It Xo Ic swap-pane
 | 
					.It Xo Ic swap-pane
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user