[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.138 and 1.139

version 1.138, 2015/11/12 11:05:34 version 1.139, 2015/11/12 11:09:11
Line 29 
Line 29 
   
 #include "tmux.h"  #include "tmux.h"
   
 char   *status_redraw_get_left(struct client *, time_t, int, struct grid_cell *,  char   *status_redraw_get_left(struct client *, time_t, struct grid_cell *,
             size_t *);              size_t *);
 char   *status_redraw_get_right(struct client *, time_t, int,  char   *status_redraw_get_right(struct client *, time_t, struct grid_cell *,
             struct grid_cell *, size_t *);              size_t *);
 char   *status_print(struct client *, struct winlink *, time_t,  char   *status_print(struct client *, struct winlink *, time_t,
             struct grid_cell *);              struct grid_cell *);
 char   *status_replace(struct client *, struct winlink *, const char *, time_t);  char   *status_replace(struct client *, struct winlink *, const char *, time_t);
Line 208 
Line 208 
   
 /* Retrieve options for left string. */  /* Retrieve options for left string. */
 char *  char *
 status_redraw_get_left(struct client *c, time_t t, int utf8flag,  status_redraw_get_left(struct client *c, time_t t, struct grid_cell *gc,
     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 222 
Line 222 
         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("%s", left);
         if (leftlen < *size)          if (leftlen < *size)
                 *size = leftlen;                  *size = leftlen;
         return (left);          return (left);
Line 230 
Line 230 
   
 /* Retrieve options for right string. */  /* Retrieve options for right string. */
 char *  char *
 status_redraw_get_right(struct client *c, time_t t, int utf8flag,  status_redraw_get_right(struct client *c, time_t t, struct grid_cell *gc,
     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 244 
Line 244 
         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("%s", right);
         if (rightlen < *size)          if (rightlen < *size)
                 *size = rightlen;                  *size = rightlen;
         return (right);          return (right);
Line 286 
Line 286 
         u_int                   offset, needed;          u_int                   offset, needed;
         u_int                   wlstart, wlwidth, wlavailable, wloffset, wlsize;          u_int                   wlstart, wlwidth, wlavailable, wloffset, wlsize;
         size_t                  llen, rlen, seplen;          size_t                  llen, rlen, seplen;
         int                     larrow, rarrow, utf8flag;          int                     larrow, rarrow;
   
         /* 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"))
Line 312 
Line 312 
         if (c->tty.sy <= 1)          if (c->tty.sy <= 1)
                 goto out;                  goto out;
   
         /* Get UTF-8 flag. */  
         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);
         left = status_redraw_get_left(c, t, utf8flag, &lgc, &llen);          left = status_redraw_get_left(c, t, &lgc, &llen);
         memcpy(&rgc, &stdgc, sizeof rgc);          memcpy(&rgc, &stdgc, sizeof rgc);
         right = status_redraw_get_right(c, t, utf8flag, &rgc, &rlen);          right = status_redraw_get_right(c, t, &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 340 
Line 337 
                 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, t, &wl->status_cell);
                 wl->status_width =                  wl->status_width = screen_write_cstrlen("%s", wl->status_text);
                     screen_write_cstrlen(utf8flag, "%s", wl->status_text);  
   
                 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("%s", sep);
                 wlwidth += wl->status_width + seplen;                  wlwidth += wl->status_width + seplen;
         }          }
   
Line 358 
Line 354 
         /* And draw the window list into it. */          /* And draw the window list into it. */
         screen_write_start(&ctx, NULL, &window_list);          screen_write_start(&ctx, NULL, &window_list);
         RB_FOREACH(wl, winlinks, &s->windows) {          RB_FOREACH(wl, winlinks, &s->windows) {
                 screen_write_cnputs(&ctx,                  screen_write_cnputs(&ctx, -1, &wl->status_cell, "%s",
                     -1, &wl->status_cell, utf8flag, "%s", wl->status_text);                      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, "%s", sep);
         }          }
         screen_write_stop(&ctx);          screen_write_stop(&ctx);
   
Line 435 
Line 431 
         /* Draw the left string and arrow. */          /* Draw the left string and arrow. */
         screen_write_cursormove(&ctx, 0, 0);          screen_write_cursormove(&ctx, 0, 0);
         if (llen != 0)          if (llen != 0)
                 screen_write_cnputs(&ctx, llen, &lgc, utf8flag, "%s", left);                  screen_write_cnputs(&ctx, llen, &lgc, "%s", left);
         if (larrow != 0) {          if (larrow != 0) {
                 memcpy(&gc, &stdgc, sizeof gc);                  memcpy(&gc, &stdgc, sizeof gc);
                 if (larrow == -1)                  if (larrow == -1)
Line 453 
Line 449 
         } else          } else
                 screen_write_cursormove(&ctx, c->tty.sx - rlen, 0);                  screen_write_cursormove(&ctx, c->tty.sx - rlen, 0);
         if (rlen != 0)          if (rlen != 0)
                 screen_write_cnputs(&ctx, rlen, &rgc, utf8flag, "%s", right);                  screen_write_cnputs(&ctx, rlen, &rgc, "%s", right);
   
         /* Figure out the offset for the window list. */          /* Figure out the offset for the window list. */
         if (llen != 0)          if (llen != 0)
Line 624 
Line 620 
         struct screen                   old_status;          struct screen                   old_status;
         size_t                          len;          size_t                          len;
         struct grid_cell                gc;          struct grid_cell                gc;
         int                             utf8flag;  
   
         if (c->tty.sx == 0 || c->tty.sy == 0)          if (c->tty.sx == 0 || c->tty.sy == 0)
                 return (0);                  return (0);
         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");          len = screen_write_strlen("%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;
   
Line 642 
Line 635 
         screen_write_start(&ctx, NULL, &c->status);          screen_write_start(&ctx, NULL, &c->status);
   
         screen_write_cursormove(&ctx, 0, 0);          screen_write_cursormove(&ctx, 0, 0);
         screen_write_nputs(&ctx, len, &gc, utf8flag, "%s", c->message_string);          screen_write_nputs(&ctx, len, &gc, "%s", c->message_string);
         for (; len < c->tty.sx; len++)          for (; len < c->tty.sx; len++)
                 screen_write_putc(&ctx, &gc, ' ');                  screen_write_putc(&ctx, &gc, ' ');
   
Line 754 
Line 747 
         struct screen                   old_status;          struct screen                   old_status;
         size_t                          i, size, left, len, off;          size_t                          i, size, left, len, off;
         struct grid_cell                gc, *gcp;          struct grid_cell                gc, *gcp;
         int                             utf8flag;  
   
         if (c->tty.sx == 0 || c->tty.sy == 0)          if (c->tty.sx == 0 || c->tty.sy == 0)
                 return (0);                  return (0);
         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");          len = screen_write_strlen("%s", c->prompt_string);
   
         len = screen_write_strlen(utf8flag, "%s", c->prompt_string);  
         if (len > c->tty.sx)          if (len > c->tty.sx)
                 len = c->tty.sx;                  len = c->tty.sx;
         off = 0;          off = 0;
Line 777 
Line 767 
         screen_write_start(&ctx, NULL, &c->status);          screen_write_start(&ctx, NULL, &c->status);
   
         screen_write_cursormove(&ctx, 0, 0);          screen_write_cursormove(&ctx, 0, 0);
         screen_write_nputs(&ctx, len, &gc, utf8flag, "%s", c->prompt_string);          screen_write_nputs(&ctx, len, &gc, "%s", c->prompt_string);
   
         left = c->tty.sx - len;          left = c->tty.sx - len;
         if (left != 0) {          if (left != 0) {
                 size = screen_write_strlen(utf8flag, "%s", c->prompt_buffer);                  size = screen_write_strlen("%s", c->prompt_buffer);
                 if (c->prompt_index >= left) {                  if (c->prompt_index >= left) {
                         off = c->prompt_index - left + 1;                          off = c->prompt_index - left + 1;
                         if (c->prompt_index == size)                          if (c->prompt_index == size)
                                 left--;                                  left--;
                         size = left;                          size = left;
                 }                  }
                 screen_write_nputs(                  screen_write_nputs(&ctx, left, &gc, "%s", c->prompt_buffer +
                     &ctx, left, &gc, utf8flag, "%s", c->prompt_buffer + off);                      off);
   
                 for (i = len + size; i < c->tty.sx; i++)                  for (i = len + size; i < c->tty.sx; i++)
                         screen_write_putc(&ctx, &gc, ' ');                          screen_write_putc(&ctx, &gc, ' ');

Legend:
Removed from v.1.138  
changed lines
  Added in v.1.139