mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
Make refresh-client force update of jobs, from Sina Siadat.
This commit is contained in:
parent
901c2eb20a
commit
16efa84838
@ -65,10 +65,13 @@ cmd_refresh_client_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
}
|
||||
if (tty_set_size(&c->tty, w, h))
|
||||
recalculate_sizes();
|
||||
} else if (args_has(args, 'S'))
|
||||
} else if (args_has(args, 'S')) {
|
||||
c->flags |= CLIENT_STATUSFORCE;
|
||||
server_status_client(c);
|
||||
else
|
||||
} else {
|
||||
c->flags |= CLIENT_STATUSFORCE;
|
||||
server_redraw_client(c);
|
||||
}
|
||||
|
||||
return (CMD_RETURN_NORMAL);
|
||||
}
|
||||
|
18
format.c
18
format.c
@ -104,7 +104,7 @@ struct format_tree {
|
||||
struct session *s;
|
||||
struct window_pane *wp;
|
||||
|
||||
int status;
|
||||
int flags;
|
||||
|
||||
RB_HEAD(format_entry_tree, format_entry) tree;
|
||||
};
|
||||
@ -216,27 +216,31 @@ const char *
|
||||
format_job_get(struct format_tree *ft, const char *cmd)
|
||||
{
|
||||
struct format_job fj0, *fj;
|
||||
time_t t;
|
||||
|
||||
fj0.cmd = cmd;
|
||||
if ((fj = RB_FIND(format_job_tree, &format_jobs, &fj0)) == NULL) {
|
||||
fj = xcalloc(1, sizeof *fj);
|
||||
fj->cmd = xstrdup(cmd);
|
||||
fj->status = ft->status;
|
||||
|
||||
xasprintf(&fj->out, "<'%s' not ready>", fj->cmd);
|
||||
|
||||
RB_INSERT(format_job_tree, &format_jobs, fj);
|
||||
}
|
||||
|
||||
if (fj->job == NULL && fj->last != time(NULL)) {
|
||||
t = time(NULL);
|
||||
if (fj->job == NULL && ((ft->flags & FORMAT_FORCE) || fj->last != t)) {
|
||||
fj->job = job_run(fj->cmd, NULL, -1, format_job_callback,
|
||||
NULL, fj);
|
||||
if (fj->job == NULL) {
|
||||
free(fj->out);
|
||||
xasprintf(&fj->out, "<'%s' didn't start>", fj->cmd);
|
||||
}
|
||||
fj->last = t;
|
||||
}
|
||||
fj->last = time(NULL);
|
||||
|
||||
if (ft->flags & FORMAT_STATUS)
|
||||
fj->status = 1;
|
||||
|
||||
return (fj->out);
|
||||
}
|
||||
@ -438,12 +442,12 @@ format_cb_pane_tabs(struct format_tree *ft, struct format_entry *fe)
|
||||
struct format_tree *
|
||||
format_create(void)
|
||||
{
|
||||
return (format_create_status(0));
|
||||
return (format_create_flags(0));
|
||||
}
|
||||
|
||||
/* Create a new tree for the status line. */
|
||||
struct format_tree *
|
||||
format_create_status(int status)
|
||||
format_create_flags(int flags)
|
||||
{
|
||||
struct format_tree *ft;
|
||||
|
||||
@ -454,7 +458,7 @@ format_create_status(int status)
|
||||
|
||||
ft = xcalloc(1, sizeof *ft);
|
||||
RB_INIT(&ft->tree);
|
||||
ft->status = status;
|
||||
ft->flags = flags;
|
||||
|
||||
format_add_cb(ft, "host", format_cb_host);
|
||||
format_add_cb(ft, "host_short", format_cb_host_short);
|
||||
|
@ -937,7 +937,8 @@ server_client_check_redraw(struct client *c)
|
||||
tty->flags = (tty->flags & ~(TTY_FREEZE|TTY_NOCURSOR)) | flags;
|
||||
tty_update_mode(tty, tty->mode, NULL);
|
||||
|
||||
c->flags &= ~(CLIENT_REDRAW|CLIENT_STATUS|CLIENT_BORDERS);
|
||||
c->flags &= ~(CLIENT_REDRAW|CLIENT_BORDERS|CLIENT_STATUS|
|
||||
CLIENT_STATUSFORCE);
|
||||
}
|
||||
|
||||
/* Set client title. */
|
||||
|
5
status.c
5
status.c
@ -503,7 +503,10 @@ status_replace(struct client *c, struct winlink *wl, const char *fmt, time_t t)
|
||||
if (fmt == NULL)
|
||||
return (xstrdup(""));
|
||||
|
||||
ft = format_create_status(1);
|
||||
if (c->flags & CLIENT_STATUSFORCE)
|
||||
ft = format_create_flags(FORMAT_STATUS|FORMAT_FORCE);
|
||||
else
|
||||
ft = format_create_flags(FORMAT_STATUS);
|
||||
format_defaults(ft, c, NULL, wl, NULL);
|
||||
|
||||
expanded = format_expand_time(ft, fmt, t);
|
||||
|
5
tmux.h
5
tmux.h
@ -1220,6 +1220,7 @@ struct client {
|
||||
#define CLIENT_UTF8 0x10000
|
||||
#define CLIENT_256COLOURS 0x20000
|
||||
#define CLIENT_IDENTIFIED 0x40000
|
||||
#define CLIENT_STATUSFORCE 0x80000
|
||||
int flags;
|
||||
struct key_table *keytable;
|
||||
|
||||
@ -1442,9 +1443,11 @@ int paste_set(char *, size_t, const char *, char **);
|
||||
char *paste_make_sample(struct paste_buffer *, int);
|
||||
|
||||
/* format.c */
|
||||
#define FORMAT_STATUS 0x1
|
||||
#define FORMAT_FORCE 0x2
|
||||
struct format_tree;
|
||||
struct format_tree *format_create(void);
|
||||
struct format_tree *format_create_status(int);
|
||||
struct format_tree *format_create_flags(int);
|
||||
void format_free(struct format_tree *);
|
||||
void printflike(3, 4) format_add(struct format_tree *, const char *,
|
||||
const char *, ...);
|
||||
|
Loading…
Reference in New Issue
Block a user