Add -n to break-pane.

This commit is contained in:
nicm 2017-01-29 22:10:55 +00:00
parent 54309cc25d
commit b6099f31ea
3 changed files with 16 additions and 9 deletions

View File

@ -34,8 +34,8 @@ const struct cmd_entry cmd_break_pane_entry = {
.name = "break-pane", .name = "break-pane",
.alias = "breakp", .alias = "breakp",
.args = { "dPF:s:t:", 0, 0 }, .args = { "dPF:n:s:t:", 0, 0 },
.usage = "[-dP] [-F format] [-s src-pane] [-t dst-window]", .usage = "[-dP] [-F format] [-n window-name] [-s src-pane] [-t dst-window]",
.sflag = CMD_PANE, .sflag = CMD_PANE,
.tflag = CMD_WINDOW_INDEX, .tflag = CMD_WINDOW_INDEX,
@ -53,8 +53,7 @@ cmd_break_pane_exec(struct cmd *self, struct cmdq_item *item)
struct session *dst_s = item->state.tflag.s; struct session *dst_s = item->state.tflag.s;
struct window_pane *wp = item->state.sflag.wp; struct window_pane *wp = item->state.sflag.wp;
struct window *w = wl->window; struct window *w = wl->window;
char *name; char *name, *cause;
char *cause;
int idx = item->state.tflag.idx; int idx = item->state.tflag.idx;
struct format_tree *ft; struct format_tree *ft;
const char *template; const char *template;
@ -78,9 +77,16 @@ cmd_break_pane_exec(struct cmd *self, struct cmdq_item *item)
w = wp->window = window_create(dst_s->sx, dst_s->sy); w = wp->window = window_create(dst_s->sx, dst_s->sy);
TAILQ_INSERT_HEAD(&w->panes, wp, entry); TAILQ_INSERT_HEAD(&w->panes, wp, entry);
w->active = wp; w->active = wp;
name = default_window_name(w);
window_set_name(w, name); if (!args_has(args, 'n')) {
free(name); name = default_window_name(w);
window_set_name(w, name);
free(name);
} else {
window_set_name(w, args_get(args, 'n'));
options_set_number(w->options, "automatic-rename", 0);
}
layout_init(w, wp); layout_init(w, wp);
wp->flags |= PANE_CHANGED; wp->flags |= PANE_CHANGED;

View File

@ -53,7 +53,7 @@ cmd_source_file_exec(struct cmd *self, struct cmdq_item *item)
struct cmdq_item *new_item; struct cmdq_item *new_item;
enum cmd_retval retval; enum cmd_retval retval;
glob_t g; glob_t g;
int i; u_int i;
quiet = args_has(args, 'q'); quiet = args_has(args, 'q');
if (glob(args->argv[0], 0, NULL, &g) != 0) { if (glob(args->argv[0], 0, NULL, &g) != 0) {
@ -64,7 +64,7 @@ cmd_source_file_exec(struct cmd *self, struct cmdq_item *item)
} }
retval = CMD_RETURN_NORMAL; retval = CMD_RETURN_NORMAL;
for (i = 0; i < g.gl_pathc; i++) { for (i = 0; i < (u_int)g.gl_pathc; i++) {
if (load_cfg(g.gl_pathv[i], c, item, quiet) != 0) if (load_cfg(g.gl_pathv[i], c, item, quiet) != 0)
retval = CMD_RETURN_ERROR; retval = CMD_RETURN_ERROR;
} }

1
tmux.1
View File

@ -1258,6 +1258,7 @@ Commands related to windows and panes are as follows:
.It Xo Ic break-pane .It Xo Ic break-pane
.Op Fl dP .Op Fl dP
.Op Fl F Ar format .Op Fl F Ar format
.Op Fl n Ar window-name
.Op Fl s Ar src-pane .Op Fl s Ar src-pane
.Op Fl t Ar dst-window .Op Fl t Ar dst-window
.Xc .Xc