From a6c22d650b2d9fba8eb069b488555ab71e5096d6 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 29 Apr 2012 17:20:01 +0000 Subject: 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. --- cmd-move-window.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'cmd-move-window.c') 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) -- cgit