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

Diff for /src/usr.bin/tmux/utf8.c between version 1.43 and 1.44

version 1.43, 2019/05/26 17:34:45 version 1.44, 2019/11/25 15:04:15
Line 390 
Line 390 
         return (width);          return (width);
 }  }
   
 /* Pad UTF-8 string to width. Caller frees. */  /* Pad UTF-8 string to width on the left. Caller frees. */
 char *  char *
 utf8_padcstr(const char *s, u_int width)  utf8_padcstr(const char *s, u_int width)
 {  {
Line 408 
Line 408 
         for (i = n; i < width; i++)          for (i = n; i < width; i++)
                 out[slen++] = ' ';                  out[slen++] = ' ';
         out[slen] = '\0';          out[slen] = '\0';
           return (out);
   }
   
   /* Pad UTF-8 string to width on the right. Caller frees. */
   char *
   utf8_rpadcstr(const char *s, u_int width)
   {
           size_t   slen;
           char    *out;
           u_int     n, i;
   
           n = utf8_cstrwidth(s);
           if (n >= width)
                   return (xstrdup(s));
   
           slen = strlen(s);
           out = xmalloc(slen + 1 + (width - n));
           for (i = 0; i < width - n; i++)
                   out[i] = ' ';
           memcpy(out + i, s, slen);
           out[i + slen] = '\0';
         return (out);          return (out);
 }  }
   

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.44