[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.136 and 1.137

version 1.136, 2015/10/20 21:12:09 version 1.137, 2015/10/27 15:58:42
Line 61 
Line 61 
         const char      *home, *history_file;          const char      *home, *history_file;
         char            *path;          char            *path;
   
         history_file = options_get_string(&global_options, "history-file");          history_file = options_get_string(global_options, "history-file");
         if (*history_file == '\0')          if (*history_file == '\0')
                 return (NULL);                  return (NULL);
         if (*history_file == '/')          if (*history_file == '/')
Line 160 
Line 160 
                 c->flags |= CLIENT_STATUS;                  c->flags |= CLIENT_STATUS;
   
         timerclear(&tv);          timerclear(&tv);
         tv.tv_sec = options_get_number(&s->options, "status-interval");          tv.tv_sec = options_get_number(s->options, "status-interval");
   
         if (tv.tv_sec != 0)          if (tv.tv_sec != 0)
                 evtimer_add(&c->status_timer, &tv);                  evtimer_add(&c->status_timer, &tv);
Line 178 
Line 178 
         else          else
                 evtimer_set(&c->status_timer, status_timer_callback, c);                  evtimer_set(&c->status_timer, status_timer_callback, c);
   
         if (s != NULL && options_get_number(&s->options, "status"))          if (s != NULL && options_get_number(s->options, "status"))
                 status_timer_callback(-1, 0, c);                  status_timer_callback(-1, 0, c);
 }  }
   
Line 198 
Line 198 
 {  {
         struct session  *s = c->session;          struct session  *s = c->session;
   
         if (!options_get_number(&s->options, "status"))          if (!options_get_number(s->options, "status"))
                 return (-1);                  return (-1);
   
         if (options_get_number(&s->options, "status-position") == 0)          if (options_get_number(s->options, "status-position") == 0)
                 return (0);                  return (0);
         return (c->tty.sy - 1);          return (c->tty.sy - 1);
 }  }
Line 216 
Line 216 
         char            *left;          char            *left;
         size_t           leftlen;          size_t           leftlen;
   
         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, t);
   
         *size = options_get_number(&s->options, "status-left-length");          *size = options_get_number(s->options, "status-left-length");
         leftlen = screen_write_cstrlen(utf8flag, "%s", left);          leftlen = screen_write_cstrlen(utf8flag, "%s", left);
         if (leftlen < *size)          if (leftlen < *size)
                 *size = leftlen;                  *size = leftlen;
Line 238 
Line 238 
         char            *right;          char            *right;
         size_t           rightlen;          size_t           rightlen;
   
         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, t);
   
         *size = options_get_number(&s->options, "status-right-length");          *size = options_get_number(s->options, "status-right-length");
         rightlen = screen_write_cstrlen(utf8flag, "%s", right);          rightlen = screen_write_cstrlen(utf8flag, "%s", right);
         if (rightlen < *size)          if (rightlen < *size)
                 *size = rightlen;                  *size = rightlen;
Line 261 
Line 261 
   
         x += c->wlmouse;          x += c->wlmouse;
         RB_FOREACH(wl, winlinks, &s->windows) {          RB_FOREACH(wl, winlinks, &s->windows) {
                 oo = &wl->window->options;                  oo = wl->window->options;
                 len = strlen(options_get_string(oo, "window-status-separator"));                  len = strlen(options_get_string(oo, "window-status-separator"));
   
                 if (x < wl->status_width)                  if (x < wl->status_width)
Line 289 
Line 289 
         int                     larrow, rarrow, utf8flag;          int                     larrow, rarrow, utf8flag;
   
         /* No status line? */          /* No status line? */
         if (c->tty.sy == 0 || !options_get_number(&s->options, "status"))          if (c->tty.sy == 0 || !options_get_number(s->options, "status"))
                 return (1);                  return (1);
         left = right = NULL;          left = right = NULL;
         larrow = rarrow = 0;          larrow = rarrow = 0;
Line 298 
Line 298 
         t = time(NULL);          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");
   
         /* Create the target screen. */          /* Create the target screen. */
         memcpy(&old_status, &c->status, sizeof old_status);          memcpy(&old_status, &c->status, sizeof old_status);
Line 313 
Line 313 
                 goto out;                  goto out;
   
         /* Get UTF-8 flag. */          /* Get UTF-8 flag. */
         utf8flag = options_get_number(&s->options, "status-utf8");          utf8flag = options_get_number(s->options, "status-utf8");
   
         /* Work out left and right strings. */          /* Work out left and right strings. */
         memcpy(&lgc, &stdgc, sizeof lgc);          memcpy(&lgc, &stdgc, sizeof lgc);
Line 346 
Line 346 
                 if (wl == s->curw)                  if (wl == s->curw)
                         wloffset = wlwidth;                          wloffset = wlwidth;
   
                 oo = &wl->window->options;                  oo = wl->window->options;
                 sep = options_get_string(oo, "window-status-separator");                  sep = options_get_string(oo, "window-status-separator");
                 seplen = screen_write_strlen(utf8flag, "%s", sep);                  seplen = screen_write_strlen(utf8flag, "%s", sep);
                 wlwidth += wl->status_width + seplen;                  wlwidth += wl->status_width + seplen;
Line 361 
Line 361 
                 screen_write_cnputs(&ctx,                  screen_write_cnputs(&ctx,
                     -1, &wl->status_cell, utf8flag, "%s", wl->status_text);                      -1, &wl->status_cell, utf8flag, "%s", wl->status_text);
   
                 oo = &wl->window->options;                  oo = wl->window->options;
                 sep = options_get_string(oo, "window-status-separator");                  sep = options_get_string(oo, "window-status-separator");
                 screen_write_nputs(&ctx, -1, &stdgc, utf8flag, "%s", sep);                  screen_write_nputs(&ctx, -1, &stdgc, utf8flag, "%s", sep);
         }          }
Line 461 
Line 461 
         else          else
                 wloffset = 0;                  wloffset = 0;
         if (wlwidth < wlavailable) {          if (wlwidth < wlavailable) {
                 switch (options_get_number(&s->options, "status-justify")) {                  switch (options_get_number(s->options, "status-justify")) {
                 case 1: /* centred */                  case 1: /* centred */
                         wloffset += (wlavailable - wlwidth) / 2;                          wloffset += (wlavailable - wlwidth) / 2;
                         break;                          break;
Line 520 
Line 520 
 status_print(struct client *c, struct winlink *wl, time_t t,  status_print(struct client *c, struct winlink *wl, time_t t,
     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;
         const char      *fmt;          const char      *fmt;
         char            *text;          char            *text;
Line 553 
Line 553 
         int                      delay;          int                      delay;
         u_int                    first, limit;          u_int                    first, limit;
   
         limit = options_get_number(&global_options, "message-limit");          limit = options_get_number(global_options, "message-limit");
   
         status_prompt_clear(c);          status_prompt_clear(c);
         status_message_clear(c);          status_message_clear(c);
Line 577 
Line 577 
                 free(msg);                  free(msg);
         }          }
   
         delay = options_get_number(&c->session->options, "display-time");          delay = options_get_number(c->session->options, "display-time");
         tv.tv_sec = delay / 1000;          tv.tv_sec = delay / 1000;
         tv.tv_usec = (delay % 1000) * 1000L;          tv.tv_usec = (delay % 1000) * 1000L;
   
Line 631 
Line 631 
         memcpy(&old_status, &c->status, sizeof old_status);          memcpy(&old_status, &c->status, sizeof old_status);
         screen_init(&c->status, c->tty.sx, 1, 0);          screen_init(&c->status, c->tty.sx, 1, 0);
   
         utf8flag = options_get_number(&s->options, "status-utf8");          utf8flag = options_get_number(s->options, "status-utf8");
   
         len = screen_write_strlen(utf8flag, "%s", c->message_string);          len = screen_write_strlen(utf8flag, "%s", c->message_string);
         if (len > c->tty.sx)          if (len > c->tty.sx)
                 len = c->tty.sx;                  len = c->tty.sx;
   
         style_apply(&gc, &s->options, "message-style");          style_apply(&gc, s->options, "message-style");
   
         screen_write_start(&ctx, NULL, &c->status);          screen_write_start(&ctx, NULL, &c->status);
   
Line 686 
Line 686 
   
         c->prompt_flags = flags;          c->prompt_flags = flags;
   
         keys = options_get_number(&c->session->options, "status-keys");          keys = options_get_number(c->session->options, "status-keys");
         if (keys == MODEKEY_EMACS)          if (keys == MODEKEY_EMACS)
                 mode_key_init(&c->prompt_mdata, &mode_key_tree_emacs_edit);                  mode_key_init(&c->prompt_mdata, &mode_key_tree_emacs_edit);
         else          else
Line 761 
Line 761 
         memcpy(&old_status, &c->status, sizeof old_status);          memcpy(&old_status, &c->status, sizeof old_status);
         screen_init(&c->status, c->tty.sx, 1, 0);          screen_init(&c->status, c->tty.sx, 1, 0);
   
         utf8flag = options_get_number(&s->options, "status-utf8");          utf8flag = options_get_number(s->options, "status-utf8");
   
         len = screen_write_strlen(utf8flag, "%s", c->prompt_string);          len = screen_write_strlen(utf8flag, "%s", c->prompt_string);
         if (len > c->tty.sx)          if (len > c->tty.sx)
Line 770 
Line 770 
   
         /* Change colours for command mode. */          /* Change colours for command mode. */
         if (c->prompt_mdata.mode == 1)          if (c->prompt_mdata.mode == 1)
                 style_apply(&gc, &s->options, "message-command-style");                  style_apply(&gc, s->options, "message-command-style");
         else          else
                 style_apply(&gc, &s->options, "message-style");                  style_apply(&gc, s->options, "message-style");
   
         screen_write_start(&ctx, NULL, &c->status);          screen_write_start(&ctx, NULL, &c->status);
   
Line 815 
Line 815 
 status_prompt_key(struct client *c, int key)  status_prompt_key(struct client *c, int key)
 {  {
         struct session          *sess = c->session;          struct session          *sess = c->session;
         struct options          *oo = &sess->options;          struct options          *oo = sess->options;
         struct paste_buffer     *pb;          struct paste_buffer     *pb;
         char                    *s, *first, *last, word[64], swapc;          char                    *s, *first, *last, word[64], swapc;
         const char              *histstr, *bufdata, *wsep = NULL;          const char              *histstr, *bufdata, *wsep = NULL;

Legend:
Removed from v.1.136  
changed lines
  Added in v.1.137