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

Diff for /src/usr.bin/tmux/grid.c between version 1.69 and 1.70

version 1.69, 2017/04/19 12:44:29 version 1.70, 2017/04/25 18:20:51
Line 675 
Line 675 
 {  {
         int     oldc[64], newc[64], s[128];          int     oldc[64], newc[64], s[128];
         size_t  noldc, nnewc, n, i;          size_t  noldc, nnewc, n, i;
         u_int   attr = gc->attr;          u_int   attr = gc->attr, lastattr = lastgc->attr;
         u_int   lastattr = lastgc->attr;  
         char    tmp[64];          char    tmp[64];
   
         struct {          struct {
Line 708 
Line 707 
                         s[n++] = attrs[i].code;                          s[n++] = attrs[i].code;
         }          }
   
         /* If the foreground colour changed, append its parameters. */          /* Write the attributes. */
           *buf = '\0';
           if (n > 0) {
                   if (escape_c0)
                           strlcat(buf, "\\033[", len);
                   else
                           strlcat(buf, "\033[", len);
                   for (i = 0; i < n; i++) {
                           if (i + 1 < n)
                                   xsnprintf(tmp, sizeof tmp, "%d;", s[i]);
                           else
                                   xsnprintf(tmp, sizeof tmp, "%d", s[i]);
                           strlcat(buf, tmp, len);
                   }
                   strlcat(buf, "m", len);
           }
   
           /* If the foreground colour changed, write its parameters. */
         nnewc = grid_string_cells_fg(gc, newc);          nnewc = grid_string_cells_fg(gc, newc);
         noldc = grid_string_cells_fg(lastgc, oldc);          noldc = grid_string_cells_fg(lastgc, oldc);
         if (nnewc != noldc || memcmp(newc, oldc, nnewc * sizeof newc[0]) != 0) {          if (nnewc != noldc ||
                 for (i = 0; i < nnewc; i++)              memcmp(newc, oldc, nnewc * sizeof newc[0]) != 0 ||
                         s[n++] = newc[i];              (n != 0 && s[0] == 0)) {
                   if (escape_c0)
                           strlcat(buf, "\\033[", len);
                   else
                           strlcat(buf, "\033[", len);
                   for (i = 0; i < nnewc; i++) {
                           if (i + 1 < nnewc)
                                   xsnprintf(tmp, sizeof tmp, "%d;", newc[i]);
                           else
                                   xsnprintf(tmp, sizeof tmp, "%d", newc[i]);
                           strlcat(buf, tmp, len);
                   }
                   strlcat(buf, "m", len);
         }          }
   
         /* If the background colour changed, append its parameters. */          /* If the background colour changed, append its parameters. */
         nnewc = grid_string_cells_bg(gc, newc);          nnewc = grid_string_cells_bg(gc, newc);
         noldc = grid_string_cells_bg(lastgc, oldc);          noldc = grid_string_cells_bg(lastgc, oldc);
         if (nnewc != noldc || memcmp(newc, oldc, nnewc * sizeof newc[0]) != 0) {          if (nnewc != noldc ||
                 for (i = 0; i < nnewc; i++)              memcmp(newc, oldc, nnewc * sizeof newc[0]) != 0 ||
                         s[n++] = newc[i];              (n != 0 && s[0] == 0)) {
         }  
   
         /* If there are any parameters, append an SGR code. */  
         *buf = '\0';  
         if (n > 0) {  
                 if (escape_c0)                  if (escape_c0)
                         strlcat(buf, "\\033[", len);                          strlcat(buf, "\\033[", len);
                 else                  else
                         strlcat(buf, "\033[", len);                          strlcat(buf, "\033[", len);
                 for (i = 0; i < n; i++) {                  for (i = 0; i < nnewc; i++) {
                         if (i + 1 < n)                          if (i + 1 < nnewc)
                                 xsnprintf(tmp, sizeof tmp, "%d;", s[i]);                                  xsnprintf(tmp, sizeof tmp, "%d;", newc[i]);
                         else                          else
                                 xsnprintf(tmp, sizeof tmp, "%d", s[i]);                                  xsnprintf(tmp, sizeof tmp, "%d", newc[i]);
                         strlcat(buf, tmp, len);                          strlcat(buf, tmp, len);
                 }                  }
                 strlcat(buf, "m", len);                  strlcat(buf, "m", len);
Line 744 
Line 767 
         /* Append shift in/shift out if needed. */          /* Append shift in/shift out if needed. */
         if ((attr & GRID_ATTR_CHARSET) && !(lastattr & GRID_ATTR_CHARSET)) {          if ((attr & GRID_ATTR_CHARSET) && !(lastattr & GRID_ATTR_CHARSET)) {
                 if (escape_c0)                  if (escape_c0)
                         strlcat(buf, "\\016", len);  /* SO */                          strlcat(buf, "\\016", len); /* SO */
                 else                  else
                         strlcat(buf, "\016", len);  /* SO */                          strlcat(buf, "\016", len);  /* SO */
         }          }
         if (!(attr & GRID_ATTR_CHARSET) && (lastattr & GRID_ATTR_CHARSET)) {          if (!(attr & GRID_ATTR_CHARSET) && (lastattr & GRID_ATTR_CHARSET)) {
                 if (escape_c0)                  if (escape_c0)
                         strlcat(buf, "\\017", len);  /* SI */                          strlcat(buf, "\\017", len); /* SI */
                 else                  else
                         strlcat(buf, "\017", len);  /* SI */                          strlcat(buf, "\017", len);  /* SI */
         }          }

Legend:
Removed from v.1.69  
changed lines
  Added in v.1.70