[BACK]Return to term.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/term.c between version 1.153 and 1.154

version 1.153, 2010/06/28 22:46:21 version 1.154, 2010/06/28 23:26:09
Line 161  term_flushln(struct termp *p)
Line 161  term_flushln(struct termp *p)
          */           */
         vbl = p->flags & TERMP_NOLPAD ? 0 : p->offset;          vbl = p->flags & TERMP_NOLPAD ? 0 : p->offset;
   
         /*  
          * FIXME: if bp is zero, we still output the first word before  
          * breaking the line.  
          */  
   
         vis = vend = i = 0;          vis = vend = i = 0;
         while (i < (int)p->col) {  
   
           while (i < (int)p->col) {
                 /*                  /*
                  * Handle literal tab characters.                   * Handle literal tab characters: collapse all
                    * subsequent tabs into a single huge set of spaces.
                  */                   */
                 for (j = i; j < (int)p->col; j++) {                  for (j = i; j < (int)p->col; j++) {
                         if ('\t' != p->buf[j])                          if ('\t' != p->buf[j])
                                 break;                                  break;
                         vend = (vis/p->tabwidth+1)*p->tabwidth;                          vend = (vis / p->tabwidth + 1) * p->tabwidth;
                         vbl += vend - vis;                          vbl += vend - vis;
                         vis = vend;                          vis = vend;
                 }                  }
Line 191  term_flushln(struct termp *p)
Line 187  term_flushln(struct termp *p)
                 for (jhy = 0; j < (int)p->col; j++) {                  for (jhy = 0; j < (int)p->col; j++) {
                         if ((j && ' ' == p->buf[j]) || '\t' == p->buf[j])                          if ((j && ' ' == p->buf[j]) || '\t' == p->buf[j])
                                 break;                                  break;
                         if (8 != p->buf[j]) {  
                                 if (vend > vis && vend < bp &&                          /* Back over the the last printed character. */
                                     ASCII_HYPH == p->buf[j])                          if (8 == p->buf[j]) {
                                         jhy = j;  
                                 vend += (*p->width)(p, p->buf[j]);  
                         } else {  
                                 assert(j);                                  assert(j);
                                 vend -= (*p->width)(p, p->buf[j - 1]);                                  vend -= (*p->width)(p, p->buf[j - 1]);
                                   continue;
                         }                          }
   
                           /* Regular word. */
                           /* Break at the hyphen point if we overrun. */
                           if (vend > vis && vend < bp &&
                                           ASCII_HYPH == p->buf[j])
                                   jhy = j;
   
                           vend += (*p->width)(p, p->buf[j]);
                 }                  }
   
                 /*                  /*
Line 308  term_flushln(struct termp *p)
Line 310  term_flushln(struct termp *p)
   
         /* Right-pad. */          /* Right-pad. */
         if (maxvis > vis + /* LINTED */          if (maxvis > vis + /* LINTED */
                         ((TERMP_TWOSPACE & p->flags) ? (*p->width)(p, ' ') : 0)) {                          ((TERMP_TWOSPACE & p->flags) ?
                            (*p->width)(p, ' ') : 0)) {
                 p->viscol += maxvis - vis;                  p->viscol += maxvis - vis;
                 (*p->advance)(p, maxvis - vis);                  (*p->advance)(p, maxvis - vis);
                 vis += (maxvis - vis);                  vis += (maxvis - vis);

Legend:
Removed from v.1.153  
changed lines
  Added in v.1.154

CVSweb