diff options
author | Thomas Adam <thomas@xteddy.org> | 2020-06-13 12:01:20 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2020-06-13 12:01:20 +0100 |
commit | 824efe7be47ff534d57da1ab66c3d0dfde86992d (patch) | |
tree | 064e4d8e67292d6b2eaf0797c67b046da031068b /cmd-new-window.c | |
parent | 4000052d92395a41cdaa79cfc1df38fc89858cf4 (diff) | |
parent | 1c78155e70a9f72ed6c191807c2b381cf114b91f (diff) | |
download | rtmux-824efe7be47ff534d57da1ab66c3d0dfde86992d.tar.gz rtmux-824efe7be47ff534d57da1ab66c3d0dfde86992d.tar.bz2 rtmux-824efe7be47ff534d57da1ab66c3d0dfde86992d.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-new-window.c')
-rw-r--r-- | cmd-new-window.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/cmd-new-window.c b/cmd-new-window.c index 722f89b9..0b24474b 100644 --- a/cmd-new-window.c +++ b/cmd-new-window.c @@ -38,8 +38,8 @@ const struct cmd_entry cmd_new_window_entry = { .name = "new-window", .alias = "neww", - .args = { "ac:de:F:kn:Pt:", 0, -1 }, - .usage = "[-adkP] [-c start-directory] [-e environment] [-F format] " + .args = { "abc:de:F:kn:Pt:", 0, -1 }, + .usage = "[-abdkP] [-c start-directory] [-e environment] [-F format] " "[-n window-name] " CMD_TARGET_WINDOW_USAGE " [command]", .target = { 't', CMD_FIND_WINDOW, CMD_FIND_WINDOW_INDEX }, @@ -58,16 +58,20 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item) struct client *tc = cmdq_get_target_client(item); struct session *s = target->s; struct winlink *wl = target->wl; - int idx = target->idx; + int idx = target->idx, before; struct winlink *new_wl; char *cause = NULL, *cp; const char *template, *add; struct cmd_find_state fs; struct args_value *value; - if (args_has(args, 'a') && (idx = winlink_shuffle_up(s, wl)) == -1) { - cmdq_error(item, "couldn't get a window index"); - return (CMD_RETURN_ERROR); + before = args_has(args, 'b'); + if (args_has(args, 'a') || before) { + idx = winlink_shuffle_up(s, wl, before); + if (idx == -1) { + cmdq_error(item, "couldn't get a window index"); + return (CMD_RETURN_ERROR); + } } memset(&sc, 0, sizeof sc); |