[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.26 and 1.27

version 1.26, 2016/01/19 15:59:12 version 1.27, 2016/01/31 09:57:41
Line 724 
Line 724 
         return (out);          return (out);
 }  }
   
   /* Trim UTF-8 string to width. Caller frees. */
   char *
   utf8_rtrimcstr(const char *s, u_int width)
   {
           struct utf8_data        *tmp, *next, *end;
           char                    *out;
           u_int                    at;
   
           tmp = utf8_fromcstr(s);
   
           for (end = tmp; end->size != 0; end++)
                   /* nothing */;
           if (end == tmp) {
                   free(tmp);
                   return (xstrdup(""));
           }
           next = end - 1;
   
           at = 0;
           for (;;)
           {
                   if (at + next->width > width) {
                           next++;
                           break;
                   }
                   at += next->width;
   
                   if (next == tmp)
                           break;
                   next--;
           }
   
           out = utf8_tocstr(next);
           free(tmp);
           return (out);
   }
   
 /* Pad UTF-8 string to width. Caller frees. */  /* Pad UTF-8 string to width. Caller frees. */
 char *  char *
 utf8_padcstr(const char *s, u_int width)  utf8_padcstr(const char *s, u_int width)

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27