summaryrefslogtreecommitdiffstats
path: root/cmd-move-window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2012-04-29 17:20:01 +0000
committerNicholas Marriott <nicm@openbsd.org>2012-04-29 17:20:01 +0000
commita6c22d650b2d9fba8eb069b488555ab71e5096d6 (patch)
treeaf123a415df233978b44eda9bbb7dbad6290bd44 /cmd-move-window.c
parente60f48ab09f75c622f45718797f83964a28769c0 (diff)
Add a flag to move-window to renumber the windows in a session (closing
any gaps) and add an option to do this automatically each time a window is killed. From Thomas Adam.
Diffstat (limited to 'cmd-move-window.c')
-rw-r--r--cmd-move-window.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/cmd-move-window.c b/cmd-move-window.c
index ee3ba59c..5e30d6b5 100644
--- a/cmd-move-window.c
+++ b/cmd-move-window.c
@@ -30,8 +30,8 @@ int cmd_move_window_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_move_window_entry = {
"move-window", "movew",
- "dks:t:", 0, 0,
- "[-dk] " CMD_SRCDST_WINDOW_USAGE,
+ "dkrs:t:", 0, 0,
+ "[-dkr] " CMD_SRCDST_WINDOW_USAGE,
0,
NULL,
NULL,
@@ -42,11 +42,22 @@ int
cmd_move_window_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct args *args = self->args;
- struct session *src, *dst;
+ struct session *src, *dst, *s;
struct winlink *wl;
char *cause;
int idx, kflag, dflag;
+ if ((s = ctx->curclient->session) == NULL)
+ return (-1);
+
+ if (args_has(args, 'r'))
+ {
+ session_renumber_windows(s);
+ recalculate_sizes();
+
+ return (0);
+ }
+
if ((wl = cmd_find_window(ctx, args_get(args, 's'), &src)) == NULL)
return (-1);
if ((idx = cmd_find_index(ctx, args_get(args, 't'), &dst)) == -2)