mirror of https://github.com/tmux/tmux.git
Expand command formats in %if and move the config file loading later (to
when the first client has identified) so all the client formats are available, fixes problems reported by Thomas Sattler.pull/1805/head
parent
250fdd08be
commit
ae541287d3
7
cfg.c
7
cfg.c
|
@ -91,14 +91,14 @@ start_cfg(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cfg_file == NULL)
|
if (cfg_file == NULL)
|
||||||
load_cfg(TMUX_CONF, NULL, NULL, CMD_PARSE_QUIET, NULL);
|
load_cfg(TMUX_CONF, c, NULL, CMD_PARSE_QUIET, NULL);
|
||||||
|
|
||||||
if (cfg_file == NULL && (home = find_home()) != NULL) {
|
if (cfg_file == NULL && (home = find_home()) != NULL) {
|
||||||
xasprintf(&cfg_file, "%s/.tmux.conf", home);
|
xasprintf(&cfg_file, "%s/.tmux.conf", home);
|
||||||
flags = CMD_PARSE_QUIET;
|
flags = CMD_PARSE_QUIET;
|
||||||
}
|
}
|
||||||
if (cfg_file != NULL)
|
if (cfg_file != NULL)
|
||||||
load_cfg(cfg_file, NULL, NULL, flags, NULL);
|
load_cfg(cfg_file, c, NULL, flags, NULL);
|
||||||
|
|
||||||
cmdq_append(NULL, cmdq_get_callback(cfg_done, NULL));
|
cmdq_append(NULL, cmdq_get_callback(cfg_done, NULL));
|
||||||
}
|
}
|
||||||
|
@ -128,6 +128,7 @@ load_cfg(const char *path, struct client *c, struct cmdq_item *item, int flags,
|
||||||
pi.file = path;
|
pi.file = path;
|
||||||
pi.line = 1;
|
pi.line = 1;
|
||||||
pi.item = item;
|
pi.item = item;
|
||||||
|
pi.c = c;
|
||||||
|
|
||||||
pr = cmd_parse_from_file(f, &pi);
|
pr = cmd_parse_from_file(f, &pi);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
@ -147,7 +148,7 @@ load_cfg(const char *path, struct client *c, struct cmdq_item *item, int flags,
|
||||||
if (item != NULL)
|
if (item != NULL)
|
||||||
cmdq_insert_after(item, new_item0);
|
cmdq_insert_after(item, new_item0);
|
||||||
else
|
else
|
||||||
cmdq_append(c, new_item0);
|
cmdq_append(NULL, new_item0);
|
||||||
cmd_list_free(pr->cmdlist);
|
cmd_list_free(pr->cmdlist);
|
||||||
|
|
||||||
if (new_item != NULL)
|
if (new_item != NULL)
|
||||||
|
|
4
format.c
4
format.c
|
@ -2006,10 +2006,10 @@ void
|
||||||
format_defaults(struct format_tree *ft, struct client *c, struct session *s,
|
format_defaults(struct format_tree *ft, struct client *c, struct session *s,
|
||||||
struct winlink *wl, struct window_pane *wp)
|
struct winlink *wl, struct window_pane *wp)
|
||||||
{
|
{
|
||||||
if (c != NULL)
|
if (c != NULL && c->name != NULL)
|
||||||
log_debug("%s: c=%s", __func__, c->name);
|
log_debug("%s: c=%s", __func__, c->name);
|
||||||
else
|
else
|
||||||
log_debug("%s: s=none", __func__);
|
log_debug("%s: c=none", __func__);
|
||||||
if (s != NULL)
|
if (s != NULL)
|
||||||
log_debug("%s: s=$%u", __func__, s->id);
|
log_debug("%s: s=$%u", __func__, s->id);
|
||||||
else
|
else
|
||||||
|
|
|
@ -1934,27 +1934,30 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg)
|
||||||
|
|
||||||
close(c->fd);
|
close(c->fd);
|
||||||
c->fd = -1;
|
c->fd = -1;
|
||||||
|
} else if (c->fd != -1) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c->fd == -1)
|
|
||||||
return;
|
|
||||||
if (tty_init(&c->tty, c, c->fd, c->term) != 0) {
|
if (tty_init(&c->tty, c, c->fd, c->term) != 0) {
|
||||||
close(c->fd);
|
close(c->fd);
|
||||||
c->fd = -1;
|
c->fd = -1;
|
||||||
return;
|
} else {
|
||||||
}
|
|
||||||
if (c->flags & CLIENT_UTF8)
|
if (c->flags & CLIENT_UTF8)
|
||||||
c->tty.flags |= TTY_UTF8;
|
c->tty.flags |= TTY_UTF8;
|
||||||
if (c->flags & CLIENT_256COLOURS)
|
if (c->flags & CLIENT_256COLOURS)
|
||||||
c->tty.term_flags |= TERM_256COLOURS;
|
c->tty.term_flags |= TERM_256COLOURS;
|
||||||
|
|
||||||
tty_resize(&c->tty);
|
tty_resize(&c->tty);
|
||||||
|
|
||||||
if (!(c->flags & CLIENT_CONTROL))
|
|
||||||
c->flags |= CLIENT_TERMINAL;
|
c->flags |= CLIENT_TERMINAL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If this is the first client that has finished identifying, load
|
||||||
|
* configuration files.
|
||||||
|
*/
|
||||||
|
if ((~c->flags & CLIENT_EXIT) &&
|
||||||
|
!cfg_finished &&
|
||||||
|
c == TAILQ_FIRST(&clients) &&
|
||||||
|
TAILQ_NEXT(c, entry) == NULL)
|
||||||
|
start_cfg();
|
||||||
|
}
|
||||||
|
|
||||||
/* Handle shell message. */
|
/* Handle shell message. */
|
||||||
static void
|
static void
|
||||||
|
|
3
server.c
3
server.c
|
@ -208,8 +208,7 @@ server_start(struct tmuxproc *client, struct event_base *base, int lockfd,
|
||||||
cmdq_append(c, cmdq_get_error(cause));
|
cmdq_append(c, cmdq_get_error(cause));
|
||||||
free(cause);
|
free(cause);
|
||||||
c->flags |= CLIENT_EXIT;
|
c->flags |= CLIENT_EXIT;
|
||||||
} else
|
}
|
||||||
start_cfg();
|
|
||||||
|
|
||||||
server_add_accept(0);
|
server_add_accept(0);
|
||||||
proc_loop(server_proc, server_loop);
|
proc_loop(server_proc, server_loop);
|
||||||
|
|
Loading…
Reference in New Issue