summaryrefslogtreecommitdiffstats
path: root/window.c
diff options
context:
space:
mode:
authornicm <nicm>2016-06-06 07:24:31 +0000
committernicm <nicm>2016-06-06 07:24:31 +0000
commit00cf5fbde6d846a10804447204dd55e8c3a68dbd (patch)
tree4632d8517797199b8433dcf91c548a289f62b7c4 /window.c
parent3c10df4f87490ecdc9d9a8ca443e57e8b96abbe9 (diff)
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.
Diffstat (limited to 'window.c')
-rw-r--r--window.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/window.c b/window.c
index 9870fbd5..a252629d 100644
--- a/window.c
+++ b/window.c
@@ -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);
}