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

Diff for /mandoc/term.c between version 1.83 and 1.84

version 1.83, 2009/06/22 13:13:10 version 1.84, 2009/07/14 15:16:41
Line 176  term_isopendelim(const char *p, int len)
Line 176  term_isopendelim(const char *p, int len)
  * Specifically, a line is whatever's in p->buf of length p->col, which   * Specifically, a line is whatever's in p->buf of length p->col, which
  * is zeroed after this function returns.   * is zeroed after this function returns.
  *   *
  * The variables TERMP_NOLPAD, TERMP_LITERAL and TERMP_NOBREAK are of   * The usage of termp:flags is as follows:
  * critical importance here.  Their behaviour follows:  
  *   *
  *  - TERMP_NOLPAD: when beginning to write the line, don't left-pad the   *  - TERMP_NOLPAD: when beginning to write the line, don't left-pad the
  *    offset value.  This is useful when doing columnar lists where the   *    offset value.  This is useful when doing columnar lists where the
Line 187  term_isopendelim(const char *p, int len)
Line 186  term_isopendelim(const char *p, int len)
  *    columns.  In short: don't print a newline and instead pad to the   *    columns.  In short: don't print a newline and instead pad to the
  *    right margin.  Used in conjunction with TERMP_NOLPAD.   *    right margin.  Used in conjunction with TERMP_NOLPAD.
  *   *
  *  - TERMP_NONOBREAK: don't newline when TERMP_NOBREAK is specified.   *  - TERMP_DANGLE: don't newline when TERMP_NOBREAK is specified and
    *    the line is overrun, and don't pad-right if it's underrun.
  *   *
    *  - TERMP_HANG: like TERMP_DANGLE, but doesn't newline when
    *    overruning, instead save the position and continue at that point
    *    when the next invocation.
    *
  *  In-line line breaking:   *  In-line line breaking:
  *   *
  *  If TERMP_NOBREAK is specified and the line overruns the right   *  If TERMP_NOBREAK is specified and the line overruns the right
Line 209  term_flushln(struct termp *p)
Line 213  term_flushln(struct termp *p)
 {  {
         int              i, j;          int              i, j;
         size_t           vbl, vsz, vis, maxvis, mmax, bp;          size_t           vbl, vsz, vis, maxvis, mmax, bp;
           static int       sv = -1;
   
         /*          /*
          * First, establish the maximum columns of "visible" content.           * First, establish the maximum columns of "visible" content.
Line 223  term_flushln(struct termp *p)
Line 228  term_flushln(struct termp *p)
         bp = TERMP_NOBREAK & p->flags ? mmax : maxvis;          bp = TERMP_NOBREAK & p->flags ? mmax : maxvis;
         vis = 0;          vis = 0;
   
           if (sv >= 0) {
                   vis = (size_t)sv;
                   sv = -1;
           }
   
         /*          /*
          * If in the standard case (left-justified), then begin with our           * If in the standard case (left-justified), then begin with our
          * indentation, otherwise (columns, etc.) just start spitting           * indentation, otherwise (columns, etc.) just start spitting
Line 298  term_flushln(struct termp *p)
Line 308  term_flushln(struct termp *p)
          */           */
   
         if ((TERMP_NOBREAK & p->flags) && vis >= maxvis) {          if ((TERMP_NOBREAK & p->flags) && vis >= maxvis) {
                 if ( ! (TERMP_NONOBREAK & p->flags)) {                  if ( ! (TERMP_DANGLE & p->flags) &&
                                   ! (TERMP_HANG & p->flags)) {
                         putchar('\n');                          putchar('\n');
                         for (i = 0; i < (int)p->rmargin; i++)                          for (i = 0; i < (int)p->rmargin; i++)
                                 putchar(' ');                                  putchar(' ');
                 }                  }
                   if (TERMP_HANG & p->flags)
                           sv = vis - maxvis;
                 p->col = 0;                  p->col = 0;
                 return;                  return;
         }          }
Line 313  term_flushln(struct termp *p)
Line 326  term_flushln(struct termp *p)
          */           */
   
         if (p->flags & TERMP_NOBREAK) {          if (p->flags & TERMP_NOBREAK) {
                 if ( ! (TERMP_NONOBREAK & p->flags))                  if ( ! (TERMP_DANGLE & p->flags))
                         for ( ; vis < maxvis; vis++)                          for ( ; vis < maxvis; vis++)
                                 putchar(' ');                                  putchar(' ');
         } else          } else

Legend:
Removed from v.1.83  
changed lines
  Added in v.1.84

CVSweb