Do we need a command at all or is the option enough?

If a manual trigger is really useful, could this be a flag to
move-window?


On Sun, Apr 22, 2012 at 02:46:52PM +0100, Thomas Adam wrote:
> This adds the definition file for the renumber-windows command, as well as
> supporting its addition in the Makefile.
> ---
>  trunk/Makefile.am            |    1 +
>  trunk/cmd-renumber-windows.c |   53 
> ++++++++++++++++++++++++++++++++++++++++++
>  trunk/cmd.c                  |    1 +
>  trunk/tmux.h                 |    1 +
>  4 files changed, 56 insertions(+)
>  create mode 100644 trunk/cmd-renumber-windows.c
> 
> diff --git a/trunk/Makefile.am b/trunk/Makefile.am
> index 5e26c57..db94c57 100644
> --- a/trunk/Makefile.am
> +++ b/trunk/Makefile.am
> @@ -104,6 +104,7 @@ dist_tmux_SOURCES = \
>       cmd-refresh-client.c \
>       cmd-rename-session.c \
>       cmd-rename-window.c \
> +     cmd-renumber-windows.c \
>       cmd-resize-pane.c \
>       cmd-respawn-pane.c \
>       cmd-respawn-window.c \
> diff --git a/trunk/cmd-renumber-windows.c b/trunk/cmd-renumber-windows.c
> new file mode 100644
> index 0000000..6cf7428
> --- /dev/null
> +++ b/trunk/cmd-renumber-windows.c
> @@ -0,0 +1,53 @@
> +/* $Id$ */
> +
> +/*
> + * Copyright (c) 2011 Nicholas Marriott <n...@users.sourceforge.net>
> + * Copyright (c) 2011 Thomas Adam <tho...@xteddy.org>
> + *
> + * Permission to use, copy, modify, and distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
> + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
> + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#include <sys/types.h>
> +
> +#include <stdlib.h>
> +
> +#include "tmux.h"
> +
> +/*
> + * Renumber all of the windows in a session in order, starting at base-index
> + * if set.
> + */
> +
> +int cmd_renumber_windows_exec(struct cmd *, struct cmd_ctx *);
> +
> +const struct cmd_entry cmd_renumber_windows_entry = {
> +     "renumber-windows", "renumberw",
> +     "t:", 0, 0,
> +     CMD_TARGET_SESSION_USAGE,
> +     0,
> +     NULL,
> +     NULL,
> +     cmd_renumber_windows_exec
> +};
> +
> +int
> +cmd_renumber_windows_exec(struct cmd *self, struct cmd_ctx *ctx)
> +{
> +     struct args     *args = self->args;
> +     struct session  *s;
> +
> +     if ((s = cmd_find_session(ctx, args_get(args, 't'), 0)) == NULL)
> +             return (-1);
> +
> +     return window_renumber_windows(s);
> +}
> diff --git a/trunk/cmd.c b/trunk/cmd.c
> index 2763a60..14dc0b9 100644
> --- a/trunk/cmd.c
> +++ b/trunk/cmd.c
> @@ -80,6 +80,7 @@ const struct cmd_entry *cmd_table[] = {
>       &cmd_refresh_client_entry,
>       &cmd_rename_session_entry,
>       &cmd_rename_window_entry,
> +     &cmd_renumber_windows_entry,
>       &cmd_resize_pane_entry,
>       &cmd_respawn_pane_entry,
>       &cmd_respawn_window_entry,
> diff --git a/trunk/tmux.h b/trunk/tmux.h
> index 8aaf042..23352d6 100644
> --- a/trunk/tmux.h
> +++ b/trunk/tmux.h
> @@ -1641,6 +1641,7 @@ extern const struct cmd_entry cmd_previous_window_entry;
>  extern const struct cmd_entry cmd_refresh_client_entry;
>  extern const struct cmd_entry cmd_rename_session_entry;
>  extern const struct cmd_entry cmd_rename_window_entry;
> +extern const struct cmd_entry cmd_renumber_windows_entry;
>  extern const struct cmd_entry cmd_resize_pane_entry;
>  extern const struct cmd_entry cmd_respawn_pane_entry;
>  extern const struct cmd_entry cmd_respawn_window_entry;
> -- 
> 1.7.10
> 
> 
> ------------------------------------------------------------------------------
> For Developers, A Lot Can Happen In A Second.
> Boundary is the first to Know...and Tell You.
> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> http://p.sf.net/sfu/Boundary-d2dvs2
> _______________________________________________
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to