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

Diff for /mandoc/out.c between version 1.65 and 1.66

version 1.65, 2017/06/08 18:11:22 version 1.66, 2017/06/12 20:14:18
Line 105  a2roffsu(const char *src, struct roffsu *dst, enum rof
Line 105  a2roffsu(const char *src, struct roffsu *dst, enum rof
  */   */
 void  void
 tblcalc(struct rofftbl *tbl, const struct tbl_span *sp,  tblcalc(struct rofftbl *tbl, const struct tbl_span *sp,
         size_t totalwidth)      size_t offset, size_t rmargin)
 {  {
         struct roffsu            su;          struct roffsu            su;
         const struct tbl_opts   *opts;          const struct tbl_opts   *opts;
Line 156  tblcalc(struct rofftbl *tbl, const struct tbl_span *sp
Line 156  tblcalc(struct rofftbl *tbl, const struct tbl_span *sp
                                     (*tbl->sulen)(&su, tbl->arg);                                      (*tbl->sulen)(&su, tbl->arg);
                         if (col->width < dp->layout->width)                          if (col->width < dp->layout->width)
                                 col->width = dp->layout->width;                                  col->width = dp->layout->width;
                         tblcalc_data(tbl, col, opts, dp, dp->block ?                          tblcalc_data(tbl, col, opts, dp,
                             totalwidth / (sp->opts->cols + 1) : 0);                              rmargin && dp->block ?
                               rmargin / (sp->opts->cols + 1) : 0);
                 }                  }
         }          }
   
Line 194  tblcalc(struct rofftbl *tbl, const struct tbl_span *sp
Line 195  tblcalc(struct rofftbl *tbl, const struct tbl_span *sp
                                 continue;                                  continue;
                         if (col->width == ewidth)                          if (col->width == ewidth)
                                 continue;                                  continue;
                         if (nxcol && totalwidth)                          if (nxcol && rmargin)
                                 xwidth += ewidth - col->width;                                  xwidth += ewidth - col->width;
                         col->width = ewidth;                          col->width = ewidth;
                 }                  }
Line 206  tblcalc(struct rofftbl *tbl, const struct tbl_span *sp
Line 207  tblcalc(struct rofftbl *tbl, const struct tbl_span *sp
          * Distribute the available width evenly.           * Distribute the available width evenly.
          */           */
   
         if (nxcol && totalwidth) {          if (nxcol && rmargin) {
                 xwidth += 3*maxcol +                  xwidth += 3*maxcol +
                     (opts->opts & (TBL_OPT_BOX | TBL_OPT_DBOX) ?                      (opts->opts & (TBL_OPT_BOX | TBL_OPT_DBOX) ?
                      2 : !!opts->lvert + !!opts->rvert);                       2 : !!opts->lvert + !!opts->rvert);
                 if (xwidth >= totalwidth)                  if (rmargin <= offset + xwidth)
                         return;                          return;
                 xwidth = totalwidth - xwidth;                  xwidth = rmargin - offset - xwidth;
   
                 /*                  /*
                  * Emulate a bug in GNU tbl width calculation that                   * Emulate a bug in GNU tbl width calculation that
Line 281  tblcalc_literal(struct rofftbl *tbl, struct roffcol *c
Line 282  tblcalc_literal(struct rofftbl *tbl, struct roffcol *c
         const char      *str;   /* Beginning of the first line. */          const char      *str;   /* Beginning of the first line. */
         const char      *beg;   /* Beginning of the current line. */          const char      *beg;   /* Beginning of the current line. */
         char            *end;   /* End of the current line. */          char            *end;   /* End of the current line. */
         size_t           sz;    /* Length of the current line. */          size_t           lsz;   /* Length of the current line. */
           size_t           wsz;   /* Length of the current word. */
   
         if (dp->string == NULL || *dp->string == '\0')          if (dp->string == NULL || *dp->string == '\0')
                 return;                  return;
         str = mw ? mandoc_strdup(dp->string) : dp->string;          str = mw ? mandoc_strdup(dp->string) : dp->string;
           lsz = 0;
         for (beg = str; beg != NULL && *beg != '\0'; beg = end) {          for (beg = str; beg != NULL && *beg != '\0'; beg = end) {
                 end = mw ? strchr(beg, ' ') : NULL;                  end = mw ? strchr(beg, ' ') : NULL;
                 if (end != NULL) {                  if (end != NULL) {
Line 293  tblcalc_literal(struct rofftbl *tbl, struct roffcol *c
Line 296  tblcalc_literal(struct rofftbl *tbl, struct roffcol *c
                         while (*end == ' ')                          while (*end == ' ')
                                 end++;                                  end++;
                 }                  }
                 sz = (*tbl->slen)(beg, tbl->arg);                  wsz = (*tbl->slen)(beg, tbl->arg);
                 if (col->width < sz)                  if (mw && lsz && lsz + 1 + wsz <= mw)
                         col->width = sz;                          lsz += 1 + wsz;
                   else
                           lsz = wsz;
                   if (col->width < lsz)
                           col->width = lsz;
         }          }
         if (mw)          if (mw)
                 free((void *)str);                  free((void *)str);

Legend:
Removed from v.1.65  
changed lines
  Added in v.1.66

CVSweb