=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-split-window.c,v retrieving revision 1.29 retrieving revision 1.30 diff -c -r1.29 -r1.30 *** src/usr.bin/tmux/cmd-split-window.c 2012/03/03 08:31:18 1.29 --- src/usr.bin/tmux/cmd-split-window.c 2012/03/04 20:50:53 1.30 *************** *** 1,4 **** ! /* $OpenBSD: cmd-split-window.c,v 1.29 2012/03/03 08:31:18 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-split-window.c,v 1.30 2012/03/04 20:50:53 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott *************** *** 33,41 **** const struct cmd_entry cmd_split_window_entry = { "split-window", "splitw", ! "c:dl:hp:Pt:v", 0, 1, ! "[-dhvP] [-c start-directory] [-p percentage|-l size] [-t target-pane] " ! "[command]", 0, cmd_split_window_key_binding, NULL, --- 33,41 ---- const struct cmd_entry cmd_split_window_entry = { "split-window", "splitw", ! "c:dF:l:hp:Pt:v", 0, 1, ! "[-dhvP] [-c start-directory] [-F format] [-p percentage|-l size] " ! "[-t target-pane] [command]", 0, cmd_split_window_key_binding, NULL, *************** *** 59,70 **** struct window *w; struct window_pane *wp, *new_wp = NULL; struct environ env; ! const char *cmd, *cwd, *shell; char *cause, *new_cause; ! u_int hlimit, paneidx; int size, percentage; enum layout_type type; struct layout_cell *lc; if ((wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp)) == NULL) return (-1); --- 59,74 ---- struct window *w; struct window_pane *wp, *new_wp = NULL; struct environ env; ! const char *cmd, *cwd, *shell; char *cause, *new_cause; ! u_int hlimit; int size, percentage; enum layout_type type; struct layout_cell *lc; + const char *template; + struct client *c; + struct format_tree *ft; + char *cp; if ((wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp)) == NULL) return (-1); *************** *** 135,143 **** environ_free(&env); if (args_has(args, 'P')) { ! if (window_pane_index(new_wp, &paneidx) != 0) ! fatalx("index not found"); ! ctx->print(ctx, "%s:%u.%u", s->name, wl->idx, paneidx); } return (0); --- 139,160 ---- environ_free(&env); if (args_has(args, 'P')) { ! template = "#{session_name}:#{window_index}.#{pane_index}"; ! if (args_has(args, 'F')) ! template = args_get(args, 'F'); ! ! ft = format_create(); ! if ((c = cmd_find_client(ctx, NULL)) != NULL) ! format_client(ft, c); ! format_session(ft, s); ! format_winlink(ft, s, wl); ! format_window_pane(ft, new_wp); ! ! cp = format_expand(ft, template); ! ctx->print(ctx, "%s", cp); ! free(cp); ! ! format_free(ft); } return (0);