[BACK]Return to status.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/status.c between version 1.184 and 1.185

version 1.184, 2019/03/12 20:02:47 version 1.185, 2019/03/14 23:14:27
Line 29 
Line 29 
   
 #include "tmux.h"  #include "tmux.h"
   
 static char     *status_redraw_get_left(struct client *, time_t,  static char     *status_redraw_get_left(struct client *, struct grid_cell *,
                      struct grid_cell *, size_t *);                       size_t *);
 static char     *status_redraw_get_right(struct client *, time_t,  static char     *status_redraw_get_right(struct client *, struct grid_cell *,
                      struct grid_cell *, size_t *);                       size_t *);
 static char     *status_print(struct client *, struct winlink *, time_t,  static char     *status_print(struct client *, struct winlink *,
                      struct grid_cell *);                       struct grid_cell *);
 static char     *status_replace(struct client *, struct winlink *, const char *,  static char     *status_replace(struct client *, struct winlink *,
                      time_t);                       const char *);
 static void      status_message_callback(int, short, void *);  static void      status_message_callback(int, short, void *);
 static void      status_timer_callback(int, short, void *);  static void      status_timer_callback(int, short, void *);
   
Line 232 
Line 232 
   
 /* Retrieve options for left string. */  /* Retrieve options for left string. */
 static char *  static char *
 status_redraw_get_left(struct client *c, time_t t, struct grid_cell *gc,  status_redraw_get_left(struct client *c, struct grid_cell *gc, size_t *size)
     size_t *size)  
 {  {
         struct session  *s = c->session;          struct session  *s = c->session;
         const char      *template;          const char      *template;
Line 243 
Line 242 
         style_apply_update(gc, s->options, "status-left-style");          style_apply_update(gc, s->options, "status-left-style");
   
         template = options_get_string(s->options, "status-left");          template = options_get_string(s->options, "status-left");
         left = status_replace(c, NULL, template, t);          left = status_replace(c, NULL, template);
   
         *size = options_get_number(s->options, "status-left-length");          *size = options_get_number(s->options, "status-left-length");
         leftlen = screen_write_cstrlen("%s", left);          leftlen = screen_write_cstrlen("%s", left);
Line 254 
Line 253 
   
 /* Retrieve options for right string. */  /* Retrieve options for right string. */
 static char *  static char *
 status_redraw_get_right(struct client *c, time_t t, struct grid_cell *gc,  status_redraw_get_right(struct client *c, struct grid_cell *gc, size_t *size)
     size_t *size)  
 {  {
         struct session  *s = c->session;          struct session  *s = c->session;
         const char      *template;          const char      *template;
Line 265 
Line 263 
         style_apply_update(gc, s->options, "status-right-style");          style_apply_update(gc, s->options, "status-right-style");
   
         template = options_get_string(s->options, "status-right");          template = options_get_string(s->options, "status-right");
         right = status_replace(c, NULL, template, t);          right = status_replace(c, NULL, template);
   
         *size = options_get_number(s->options, "status-right-length");          *size = options_get_number(s->options, "status-right-length");
         rightlen = screen_write_cstrlen("%s", right);          rightlen = screen_write_cstrlen("%s", right);
Line 308 
Line 306 
         struct screen            old_status, window_list;          struct screen            old_status, window_list;
         struct grid_cell         stdgc, lgc, rgc, gc;          struct grid_cell         stdgc, lgc, rgc, gc;
         struct options          *oo;          struct options          *oo;
         time_t                   t;  
         char                    *left, *right;          char                    *left, *right;
         const char              *sep;          const char              *sep;
         u_int                    offset, needed, lines;          u_int                    offset, needed, lines;
Line 330 
Line 327 
         left = right = NULL;          left = right = NULL;
         larrow = rarrow = 0;          larrow = rarrow = 0;
   
         /* Store current time. */  
         t = time(NULL);  
   
         /* Set up default colour. */          /* Set up default colour. */
         style_apply(&stdgc, s->options, "status-style");          style_apply(&stdgc, s->options, "status-style");
   
Line 350 
Line 344 
   
         /* Work out left and right strings. */          /* Work out left and right strings. */
         memcpy(&lgc, &stdgc, sizeof lgc);          memcpy(&lgc, &stdgc, sizeof lgc);
         left = status_redraw_get_left(c, t, &lgc, &llen);          left = status_redraw_get_left(c, &lgc, &llen);
         memcpy(&rgc, &stdgc, sizeof rgc);          memcpy(&rgc, &stdgc, sizeof rgc);
         right = status_redraw_get_right(c, t, &rgc, &rlen);          right = status_redraw_get_right(c, &rgc, &rlen);
   
         /*          /*
          * Figure out how much space we have for the window list. If there           * Figure out how much space we have for the window list. If there
Line 372 
Line 366 
         RB_FOREACH(wl, winlinks, &s->windows) {          RB_FOREACH(wl, winlinks, &s->windows) {
                 free(wl->status_text);                  free(wl->status_text);
                 memcpy(&wl->status_cell, &stdgc, sizeof wl->status_cell);                  memcpy(&wl->status_cell, &stdgc, sizeof wl->status_cell);
                 wl->status_text = status_print(c, wl, t, &wl->status_cell);                  wl->status_text = status_print(c, wl, &wl->status_cell);
                 wl->status_width = screen_write_cstrlen("%s", wl->status_text);                  wl->status_width = screen_write_cstrlen("%s", wl->status_text);
   
                 if (wl == s->curw)                  if (wl == s->curw)
Line 531 
Line 525 
   
 /* Replace special sequences in fmt. */  /* Replace special sequences in fmt. */
 static char *  static char *
 status_replace(struct client *c, struct winlink *wl, const char *fmt, time_t t)  status_replace(struct client *c, struct winlink *wl, const char *fmt)
 {  {
         struct format_tree      *ft;          struct format_tree      *ft;
         char                    *expanded;          char                    *expanded;
Line 550 
Line 544 
                 ft = format_create(c, NULL, tag, FORMAT_STATUS);                  ft = format_create(c, NULL, tag, FORMAT_STATUS);
         format_defaults(ft, c, NULL, wl, NULL);          format_defaults(ft, c, NULL, wl, NULL);
   
         expanded = format_expand_time(ft, fmt, t);          expanded = format_expand_time(ft, fmt);
   
         format_free(ft);          format_free(ft);
         return (expanded);          return (expanded);
Line 558 
Line 552 
   
 /* Return winlink status line entry and adjust gc as necessary. */  /* Return winlink status line entry and adjust gc as necessary. */
 static char *  static char *
 status_print(struct client *c, struct winlink *wl, time_t t,  status_print(struct client *c, struct winlink *wl, struct grid_cell *gc)
     struct grid_cell *gc)  
 {  {
         struct options  *oo = wl->window->options;          struct options  *oo = wl->window->options;
         struct session  *s = c->session;          struct session  *s = c->session;
Line 580 
Line 573 
         else if (wl->flags & (WINLINK_ACTIVITY|WINLINK_SILENCE))          else if (wl->flags & (WINLINK_ACTIVITY|WINLINK_SILENCE))
                 style_apply_update(gc, oo, "window-status-activity-style");                  style_apply_update(gc, oo, "window-status-activity-style");
   
         text = status_replace(c, wl, fmt, t);          text = status_replace(c, wl, fmt);
         return (text);          return (text);
 }  }
   
Line 698 
Line 691 
     prompt_input_cb inputcb, prompt_free_cb freecb, void *data, int flags)      prompt_input_cb inputcb, prompt_free_cb freecb, void *data, int flags)
 {  {
         struct format_tree      *ft;          struct format_tree      *ft;
         time_t                   t;  
         char                    *tmp, *cp;          char                    *tmp, *cp;
   
         ft = format_create(c, NULL, FORMAT_NONE, 0);          ft = format_create(c, NULL, FORMAT_NONE, 0);
         format_defaults(ft, c, NULL, NULL, NULL);          format_defaults(ft, c, NULL, NULL, NULL);
         t = time(NULL);  
   
         if (input == NULL)          if (input == NULL)
                 input = "";                  input = "";
         if (flags & PROMPT_NOFORMAT)          if (flags & PROMPT_NOFORMAT)
                 tmp = xstrdup(input);                  tmp = xstrdup(input);
         else          else
                 tmp = format_expand_time(ft, input, t);                  tmp = format_expand_time(ft, input);
   
         status_message_clear(c);          status_message_clear(c);
         status_prompt_clear(c);          status_prompt_clear(c);
Line 722 
Line 713 
                 screen_init(&c->status.status, c->tty.sx, 1, 0);                  screen_init(&c->status.status, c->tty.sx, 1, 0);
         }          }
   
         c->prompt_string = format_expand_time(ft, msg, t);          c->prompt_string = format_expand_time(ft, msg);
   
         c->prompt_buffer = utf8_fromcstr(tmp);          c->prompt_buffer = utf8_fromcstr(tmp);
         c->prompt_index = utf8_strlen(c->prompt_buffer);          c->prompt_index = utf8_strlen(c->prompt_buffer);
Line 780 
Line 771 
 status_prompt_update(struct client *c, const char *msg, const char *input)  status_prompt_update(struct client *c, const char *msg, const char *input)
 {  {
         struct format_tree      *ft;          struct format_tree      *ft;
         time_t                   t;  
         char                    *tmp;          char                    *tmp;
   
         ft = format_create(c, NULL, FORMAT_NONE, 0);          ft = format_create(c, NULL, FORMAT_NONE, 0);
         format_defaults(ft, c, NULL, NULL, NULL);          format_defaults(ft, c, NULL, NULL, NULL);
   
         t = time(NULL);          tmp = format_expand_time(ft, input);
         tmp = format_expand_time(ft, input, t);  
   
         free(c->prompt_string);          free(c->prompt_string);
         c->prompt_string = format_expand_time(ft, msg, t);          c->prompt_string = format_expand_time(ft, msg);
   
         free(c->prompt_buffer);          free(c->prompt_buffer);
         c->prompt_buffer = utf8_fromcstr(tmp);          c->prompt_buffer = utf8_fromcstr(tmp);

Legend:
Removed from v.1.184  
changed lines
  Added in v.1.185