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

Diff for /src/usr.bin/mandoc/term.c between version 1.29 and 1.30

version 1.29, 2010/04/13 22:41:48 version 1.30, 2010/04/23 00:23:47
Line 79 
Line 79 
                 perror(NULL);                  perror(NULL);
                 exit(EXIT_FAILURE);                  exit(EXIT_FAILURE);
         }          }
           p->tabwidth = 5;
         p->enc = enc;          p->enc = enc;
         return(p);          return(p);
 }  }
Line 154 
Line 155 
          * breaking the line.           * breaking the line.
          */           */
   
         vis = vend = i = 0;          vis = i = 0;
         while (i < (int)p->col) {          while (i < (int)p->col) {
   
                 /*                  /*
Line 165 
Line 166 
                 vbl = (size_t)(ASCII_EOS == p->buf[i] ? 2 :                  vbl = (size_t)(ASCII_EOS == p->buf[i] ? 2 :
                                 (0 == vis ? 0 : 1));                                  (0 == vis ? 0 : 1));
                 vis += vbl;                  vis += vbl;
                   vend = vis;
   
                 /*                  /*
                    * Handle literal tab characters.
                    */
                   for (j = i; j < (int)p->col; j++) {
                           if ('\t' != p->buf[j])
                                   break;
                           /* Collapse tab with inter-word spacing. */
                           if (vis > 0 && j == i)
                                   vend = vis - 1;
                           vend = (vend/p->tabwidth+1)*p->tabwidth;
                           vbl += vend - vis;
                           vis = vend;
                   }
   
                   /*
                  * Count up visible word characters.  Control sequences                   * Count up visible word characters.  Control sequences
                  * (starting with the CSI) aren't counted.  A space                   * (starting with the CSI) aren't counted.  A space
                  * generates a non-printing word, which is valid (the                   * generates a non-printing word, which is valid (the
Line 174 
Line 190 
                  */                   */
   
                 /* LINTED */                  /* LINTED */
                 for (j = i, jhy = 0, vend = vis; j < (int)p->col; j++) {                  for (jhy = 0; j < (int)p->col; j++) {
                         if (j && ' ' == p->buf[j])                          if ((j && ' ' == p->buf[j]) || '\t' == p->buf[j])
                                 break;                                  break;
                         else if (8 == p->buf[j])                          else if (8 == p->buf[j])
                                 vend--;                                  vend--;
Line 233 
Line 249 
                 }                  }
   
                 /*                  /*
                    * Skip leading tabs, they were handled above.
                    */
                   while (i < (int)p->col && '\t' == p->buf[i])
                           i++;
   
                   /*
                  * Finally, write out the word.                   * Finally, write out the word.
                  */                   */
                 for ( ; i < (int)p->col; i++) {                  for ( ; i < (int)p->col; i++) {
                         if (vend > bp && jhy > 0 && i > jhy)                          if (vend > bp && jhy > 0 && i > jhy)
                                   break;
                           if ('\t' == p->buf[i])
                                 break;                                  break;
                         if (' ' == p->buf[i]) {                          if (' ' == p->buf[i]) {
                                 i++;                                  i++;

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30