In order that people can use formats like #D in #() in the status line

and not have to wait for an update when they change pane, we allow
commands to run more than once a second if the expanded form
changes. Unfortunately this can mean them being run far too often
(pretty much continually) when multiple clients exist, because some
formats (including #D) will always differ between clients.

To avoid this, give each client its own tree of jobs which means that
the same command will be different instances for each client - similar
to how we have the tag to separate commands for different panes.

GitHub issue 889; test case reported by Paul Johnson.
This commit is contained in:
nicm
2017-05-01 12:20:55 +00:00
parent a2dd7daf4e
commit 0ccfb61bb0
17 changed files with 82 additions and 32 deletions

View File

@ -519,9 +519,9 @@ status_replace(struct client *c, struct winlink *wl, const char *fmt, time_t t)
else
tag = FORMAT_NONE;
if (c->flags & CLIENT_STATUSFORCE)
ft = format_create(NULL, tag, FORMAT_STATUS|FORMAT_FORCE);
ft = format_create(c, NULL, tag, FORMAT_STATUS|FORMAT_FORCE);
else
ft = format_create(NULL, tag, FORMAT_STATUS);
ft = format_create(c, NULL, tag, FORMAT_STATUS);
format_defaults(ft, c, NULL, wl, NULL);
expanded = format_expand_time(ft, fmt, t);
@ -663,7 +663,7 @@ status_prompt_set(struct client *c, const char *msg, const char *input,
time_t t;
char *tmp;
ft = format_create(NULL, FORMAT_NONE, 0);
ft = format_create(c, NULL, FORMAT_NONE, 0);
format_defaults(ft, c, NULL, NULL, NULL);
t = time(NULL);
@ -724,7 +724,7 @@ status_prompt_update(struct client *c, const char *msg, const char *input)
time_t t;
char *tmp;
ft = format_create(NULL, FORMAT_NONE, 0);
ft = format_create(c, NULL, FORMAT_NONE, 0);
format_defaults(ft, c, NULL, NULL, NULL);
t = time(NULL);