Insert full size panes at the right position, from KOIE Hidetaka in

GitHub issue 1284.
This commit is contained in:
nicm
2018-03-16 15:15:39 +00:00
parent 19f3a5c612
commit f87d80737e
3 changed files with 15 additions and 9 deletions

View File

@ -341,7 +341,7 @@ window_create_spawn(const char *name, int argc, char **argv, const char *path,
struct window_pane *wp;
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);
if (window_pane_spawn(wp, argc, argv, path, shell, cwd,
@ -610,7 +610,7 @@ window_unzoom(struct window *w)
struct window_pane *
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;
@ -623,10 +623,16 @@ window_add_pane(struct window *w, struct window_pane *other, int before,
TAILQ_INSERT_HEAD(&w->panes, wp, entry);
} else if (before) {
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 {
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);
}