From b728970c654cc16476f4e923cb435512d20b47f3 Mon Sep 17 00:00:00 2001 From: Tiago Cunha Date: Thu, 3 May 2012 17:51:04 +0000 Subject: Sync OpenBSD patchset 1104: 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 5c4dbbe8..acb50442 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