mirror of
https://github.com/tmate-io/tmate.git
synced 2024-12-23 15:19:06 +01:00
Move window name changes into wrapper function window_set_name, from
George Nachman.
This commit is contained in:
parent
fdeaa73342
commit
8363d19307
@ -46,6 +46,7 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
struct session *s;
|
||||
struct window_pane *wp;
|
||||
struct window *w;
|
||||
char *name;
|
||||
char *cause;
|
||||
int base_idx;
|
||||
|
||||
@ -74,7 +75,9 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
w = wp->window = window_create1(s->sx, s->sy);
|
||||
TAILQ_INSERT_HEAD(&w->panes, wp, entry);
|
||||
w->active = wp;
|
||||
w->name = default_window_name(w);
|
||||
name = default_window_name(w);
|
||||
window_set_name(w, name);
|
||||
xfree(name);
|
||||
layout_init(w);
|
||||
|
||||
base_idx = options_get_number(&s->options, "base-index");
|
||||
|
@ -217,8 +217,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
if (cmd != NULL && args_has(args, 'n')) {
|
||||
w = s->curw->window;
|
||||
|
||||
xfree(w->name);
|
||||
w->name = xstrdup(args_get(args, 'n'));
|
||||
window_set_name(w, args_get(args, 'n'));
|
||||
|
||||
options_set_number(&w->options, "automatic-rename", 0);
|
||||
}
|
||||
|
@ -48,8 +48,7 @@ cmd_rename_window_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
if ((wl = cmd_find_window(ctx, args_get(args, 't'), &s)) == NULL)
|
||||
return (-1);
|
||||
|
||||
xfree(wl->window->name);
|
||||
wl->window->name = xstrdup(args->argv[0]);
|
||||
window_set_name(wl->window, args->argv[0]);
|
||||
options_set_number(&wl->window->options, "automatic-rename", 0);
|
||||
|
||||
server_status_window(wl->window);
|
||||
|
3
input.c
3
input.c
@ -1552,8 +1552,7 @@ input_exit_rename(struct input_ctx *ictx)
|
||||
return;
|
||||
log_debug("%s: \"%s\"", __func__, ictx->input_buf);
|
||||
|
||||
xfree(ictx->wp->window->name);
|
||||
ictx->wp->window->name = xstrdup(ictx->input_buf);
|
||||
window_set_name(ictx->wp->window, ictx->input_buf);
|
||||
options_set_number(&ictx->wp->window->options, "automatic-rename", 0);
|
||||
|
||||
server_status_window(ictx->wp->window);
|
||||
|
1
tmux.h
1
tmux.h
@ -1968,6 +1968,7 @@ struct window_pane *window_pane_find_up(struct window_pane *);
|
||||
struct window_pane *window_pane_find_down(struct window_pane *);
|
||||
struct window_pane *window_pane_find_left(struct window_pane *);
|
||||
struct window_pane *window_pane_find_right(struct window_pane *);
|
||||
void window_set_name(struct window *, const char *);
|
||||
|
||||
/* layout.c */
|
||||
u_int layout_count_cells(struct layout_cell *);
|
||||
|
Loading…
Reference in New Issue
Block a user