Insert new panes after the pane being split in the list rather than

always after the active pane. This is more sensible when doing it with
commands rather than keys.
pull/432/merge
nicm 2016-06-06 07:24:31 +00:00
parent 3c10df4f87
commit 00cf5fbde6
3 changed files with 11 additions and 6 deletions

View File

@ -136,7 +136,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
cause = xstrdup("pane too small");
goto error;
}
new_wp = window_add_pane(w, hlimit);
new_wp = window_add_pane(w, wp, hlimit);
layout_assign_pane(lc, new_wp);
path = NULL;

3
tmux.h
View File

@ -2130,7 +2130,8 @@ int window_has_pane(struct window *, struct window_pane *);
int window_set_active_pane(struct window *, struct window_pane *);
void window_redraw_active_switch(struct window *,
struct window_pane *);
struct window_pane *window_add_pane(struct window *, u_int);
struct window_pane *window_add_pane(struct window *, struct window_pane *,
u_int);
void window_resize(struct window *, u_int, u_int);
int window_zoom(struct window_pane *);
int window_unzoom(struct window *);

View File

@ -323,7 +323,7 @@ window_create(const char *name, int argc, char **argv, const char *path,
struct window_pane *wp;
w = window_create1(sx, sy);
wp = window_add_pane(w, hlimit);
wp = window_add_pane(w, NULL, hlimit);
layout_init(w, wp);
if (window_pane_spawn(wp, argc, argv, path, shell, cwd, env, tio,
@ -553,15 +553,19 @@ window_unzoom(struct window *w)
}
struct window_pane *
window_add_pane(struct window *w, u_int hlimit)
window_add_pane(struct window *w, struct window_pane *after, u_int hlimit)
{
struct window_pane *wp;
wp = window_pane_create(w, w->sx, w->sy, hlimit);
if (TAILQ_EMPTY(&w->panes))
TAILQ_INSERT_HEAD(&w->panes, wp, entry);
else
TAILQ_INSERT_AFTER(&w->panes, w->active, wp, entry);
else {
if (after == NULL)
TAILQ_INSERT_AFTER(&w->panes, w->active, wp, entry);
else
TAILQ_INSERT_AFTER(&w->panes, after, wp, entry);
}
return (wp);
}