mirror of
https://github.com/tmux/tmux.git
synced 2024-12-25 02:48:47 +00:00
Do not display configuration file errors in a pane when in control mode,
instead report them with a %config-error notification. GitHub issue 3193.
This commit is contained in:
parent
d9f84854ac
commit
a888ce9963
24
cfg.c
24
cfg.c
@ -52,8 +52,7 @@ cfg_done(__unused struct cmdq_item *item, __unused void *data)
|
|||||||
return (CMD_RETURN_NORMAL);
|
return (CMD_RETURN_NORMAL);
|
||||||
cfg_finished = 1;
|
cfg_finished = 1;
|
||||||
|
|
||||||
if (!RB_EMPTY(&sessions))
|
cfg_show_causes(NULL);
|
||||||
cfg_show_causes(RB_MIN(sessions, &sessions));
|
|
||||||
|
|
||||||
if (cfg_item != NULL)
|
if (cfg_item != NULL)
|
||||||
cmdq_continue(cfg_item);
|
cmdq_continue(cfg_item);
|
||||||
@ -239,11 +238,29 @@ cfg_print_causes(struct cmdq_item *item)
|
|||||||
void
|
void
|
||||||
cfg_show_causes(struct session *s)
|
cfg_show_causes(struct session *s)
|
||||||
{
|
{
|
||||||
|
struct client *c = TAILQ_FIRST(&clients);
|
||||||
struct window_pane *wp;
|
struct window_pane *wp;
|
||||||
struct window_mode_entry *wme;
|
struct window_mode_entry *wme;
|
||||||
u_int i;
|
u_int i;
|
||||||
|
|
||||||
if (s == NULL || cfg_ncauses == 0)
|
if (cfg_ncauses == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (c != NULL && (c->flags & CLIENT_CONTROL)) {
|
||||||
|
for (i = 0; i < cfg_ncauses; i++) {
|
||||||
|
control_write(c, "%%config-error %s", cfg_causes[i]);
|
||||||
|
free(cfg_causes[i]);
|
||||||
|
}
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s == NULL) {
|
||||||
|
if (c != NULL && c->session != NULL)
|
||||||
|
s = c->session;
|
||||||
|
else
|
||||||
|
s = RB_MIN(sessions, &sessions);
|
||||||
|
}
|
||||||
|
if (s == NULL || s->attached == 0) /* wait for an attached session */
|
||||||
return;
|
return;
|
||||||
wp = s->curw->window->active;
|
wp = s->curw->window->active;
|
||||||
|
|
||||||
@ -255,6 +272,7 @@ cfg_show_causes(struct session *s)
|
|||||||
free(cfg_causes[i]);
|
free(cfg_causes[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
free(cfg_causes);
|
free(cfg_causes);
|
||||||
cfg_causes = NULL;
|
cfg_causes = NULL;
|
||||||
cfg_ncauses = 0;
|
cfg_ncauses = 0;
|
||||||
|
@ -335,7 +335,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* If there are still configuration file errors to display, put the new
|
* If there are still configuration file errors to display, put the new
|
||||||
* session's current window into more mode and display them now.
|
* session's current window into view mode and display them now.
|
||||||
*/
|
*/
|
||||||
if (cfg_finished)
|
if (cfg_finished)
|
||||||
cfg_show_causes(s);
|
cfg_show_causes(s);
|
||||||
|
2
tmux.1
2
tmux.1
@ -6529,6 +6529,8 @@ The client is now attached to the session with ID
|
|||||||
.Ar session-id ,
|
.Ar session-id ,
|
||||||
which is named
|
which is named
|
||||||
.Ar name .
|
.Ar name .
|
||||||
|
.It Ic %config-error Ar error
|
||||||
|
An error has happened in a configuration file.
|
||||||
.It Ic %continue Ar pane-id
|
.It Ic %continue Ar pane-id
|
||||||
The pane has been continued after being paused (if the
|
The pane has been continued after being paused (if the
|
||||||
.Ar pause-after
|
.Ar pause-after
|
||||||
|
Loading…
Reference in New Issue
Block a user