diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c index 31587652..fde6baaa 100644 --- a/cmd-pipe-pane.c +++ b/cmd-pipe-pane.c @@ -109,8 +109,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_q *cmdq) closefrom(STDERR_FILENO + 1); - command = status_replace( - c, NULL, NULL, NULL, args->argv[0], time(NULL), 0); + command = status_replace(c, NULL, args->argv[0], time(NULL), 0); execl(_PATH_BSHELL, "sh", "-c", command, (char *) NULL); _exit(1); default: diff --git a/server-client.c b/server-client.c index e0b0c668..6c475f2d 100644 --- a/server-client.c +++ b/server-client.c @@ -779,7 +779,7 @@ server_client_set_title(struct client *c) template = options_get_string(&s->options, "set-titles-string"); - title = status_replace(c, NULL, NULL, NULL, template, time(NULL), 1); + title = status_replace(c, NULL, template, time(NULL), 1); if (c->title == NULL || strcmp(title, c->title) != 0) { free(c->title); c->title = xstrdup(title); diff --git a/status.c b/status.c index 6d6c7c98..dc6d390e 100644 --- a/status.c +++ b/status.c @@ -75,17 +75,18 @@ status_at_line(struct client *c) /* Retrieve options for left string. */ char * -status_redraw_get_left(struct client *c, - time_t t, int utf8flag, struct grid_cell *gc, size_t *size) +status_redraw_get_left(struct client *c, time_t t, int utf8flag, + struct grid_cell *gc, size_t *size) { struct session *s = c->session; + const char *template; char *left; size_t leftlen; style_apply_update(gc, &s->options, "status-left-style"); - left = status_replace(c, NULL, - NULL, NULL, options_get_string(&s->options, "status-left"), t, 1); + template = options_get_string(&s->options, "status-left"); + left = status_replace(c, NULL, template , t, 1); *size = options_get_number(&s->options, "status-left-length"); leftlen = screen_write_cstrlen(utf8flag, "%s", left); @@ -96,17 +97,18 @@ status_redraw_get_left(struct client *c, /* Retrieve options for right string. */ char * -status_redraw_get_right(struct client *c, - time_t t, int utf8flag, struct grid_cell *gc, size_t *size) +status_redraw_get_right(struct client *c, time_t t, int utf8flag, + struct grid_cell *gc, size_t *size) { struct session *s = c->session; + const char *template; char *right; size_t rightlen; style_apply_update(gc, &s->options, "status-right-style"); - right = status_replace(c, NULL, - NULL, NULL, options_get_string(&s->options, "status-right"), t, 1); + template = options_get_string(&s->options, "status-right"); + right = status_replace(c, NULL, template, t, 1); *size = options_get_number(&s->options, "status-right-length"); rightlen = screen_write_cstrlen(utf8flag, "%s", right); @@ -432,9 +434,11 @@ skip_to: /* Replace special sequences in fmt. */ char * -status_replace(struct client *c, struct session *s, struct winlink *wl, - struct window_pane *wp, const char *fmt, time_t t, int jobsflag) +status_replace(struct client *c, struct winlink *wl, const char *fmt, time_t t, + int jobsflag) { + struct session *s = NULL; + struct window_pane *wp = NULL; static char out[BUFSIZ]; char in[BUFSIZ], ch, *iptr, *optr, *expanded; size_t len; @@ -443,11 +447,11 @@ status_replace(struct client *c, struct session *s, struct winlink *wl, if (fmt == NULL) return (xstrdup("")); - if (s == NULL && c != NULL) + if (c != NULL) s = c->session; if (wl == NULL && s != NULL) wl = s->curw; - if (wp == NULL && wl != NULL) + if (wl != NULL) wp = wl->window->active; len = strftime(in, sizeof in, fmt, localtime(&t)); @@ -620,8 +624,8 @@ status_job_callback(struct job *job) /* Return winlink status line entry and adjust gc as necessary. */ char * -status_print( - struct client *c, struct winlink *wl, time_t t, struct grid_cell *gc) +status_print(struct client *c, struct winlink *wl, time_t t, + struct grid_cell *gc) { struct options *oo = &wl->window->options; struct session *s = c->session; @@ -642,7 +646,7 @@ status_print( else if (wl->flags & (WINLINK_ACTIVITY|WINLINK_SILENCE)) style_apply_update(gc, oo, "window-status-activity-style"); - text = status_replace(c, NULL, wl, NULL, fmt, t, 1); + text = status_replace(c, wl, fmt, t, 1); return (text); } @@ -768,11 +772,9 @@ status_prompt_set(struct client *c, const char *msg, const char *input, status_message_clear(c); status_prompt_clear(c); - c->prompt_string = status_replace(c, NULL, NULL, NULL, msg, - time(NULL), 0); + c->prompt_string = status_replace(c, NULL, msg, time(NULL), 0); - c->prompt_buffer = status_replace(c, NULL, NULL, NULL, input, - time(NULL), 0); + c->prompt_buffer = status_replace(c, NULL, input, time(NULL), 0); c->prompt_index = strlen(c->prompt_buffer); c->prompt_callbackfn = callbackfn; @@ -820,12 +822,10 @@ void status_prompt_update(struct client *c, const char *msg, const char *input) { free(c->prompt_string); - c->prompt_string = status_replace(c, NULL, NULL, NULL, msg, - time(NULL), 0); + c->prompt_string = status_replace(c, NULL, msg, time(NULL), 0); free(c->prompt_buffer); - c->prompt_buffer = status_replace(c, NULL, NULL, NULL, input, - time(NULL), 0); + c->prompt_buffer = status_replace(c, NULL, input, time(NULL), 0); c->prompt_index = strlen(c->prompt_buffer); c->prompt_hindex = 0; diff --git a/tmux.h b/tmux.h index c73b59ca..6b974698 100644 --- a/tmux.h +++ b/tmux.h @@ -1926,8 +1926,8 @@ void status_free_jobs(struct status_out_tree *); void status_update_jobs(struct client *); void status_set_window_at(struct client *, u_int); int status_redraw(struct client *); -char *status_replace(struct client *, struct session *, struct winlink *, - struct window_pane *, const char *, time_t, int); +char *status_replace(struct client *, struct winlink *, const char *, time_t, + int); void printflike(2, 3) status_message_set(struct client *, const char *, ...); void status_message_clear(struct client *); int status_message_redraw(struct client *);