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

Diff for /mandoc/tbl_term.c between version 1.12 and 1.13

version 1.12, 2011/01/07 13:20:58 version 1.13, 2011/01/07 14:59:52
Line 272  tbl_data(struct termp *tp, const struct tbl *tbl,
Line 272  tbl_data(struct termp *tp, const struct tbl *tbl,
                 break;                  break;
         }          }
   
         pos = dp->layout ? dp->layout->pos : TBL_CELL_LEFT;          pos = dp && dp->layout ? dp->layout->pos : TBL_CELL_LEFT;
   
         switch (pos) {          switch (pos) {
         case (TBL_CELL_HORIZ):          case (TBL_CELL_HORIZ):
Line 344  tbl_literal(struct termp *tp, const struct tbl_dat *dp
Line 344  tbl_literal(struct termp *tp, const struct tbl_dat *dp
 {  {
         size_t           padl, padr, ssz;          size_t           padl, padr, ssz;
         enum tbl_cellt   pos;          enum tbl_cellt   pos;
           const char      *str;
   
         padl = padr = 0;          padl = padr = 0;
   
         pos = dp->layout ? dp->layout->pos : TBL_CELL_LEFT;          pos = dp && dp->layout ? dp->layout->pos : TBL_CELL_LEFT;
           str = dp && dp->string ? dp->string : "";
   
         ssz = term_len(tp, 1);          ssz = term_len(tp, 1);
   
         switch (pos) {          switch (pos) {
         case (TBL_CELL_LONG):          case (TBL_CELL_LONG):
                 padl = ssz;                  padl = ssz;
                 padr = col->width - term_strlen(tp, dp->string) - ssz;                  padr = col->width - term_strlen(tp, str) - ssz;
                 break;                  break;
         case (TBL_CELL_CENTRE):          case (TBL_CELL_CENTRE):
                 padl = col->width - term_strlen(tp, dp->string);                  padl = col->width - term_strlen(tp, str);
                 if (padl % 2)                  if (padl % 2)
                         padr++;                          padr++;
                 padl /= 2;                  padl /= 2;
                 padr += padl;                  padr += padl;
                 break;                  break;
         case (TBL_CELL_RIGHT):          case (TBL_CELL_RIGHT):
                 padl = col->width - term_strlen(tp, dp->string);                  padl = col->width - term_strlen(tp, str);
                 break;                  break;
         default:          default:
                 padr = col->width - term_strlen(tp, dp->string);                  padr = col->width - term_strlen(tp, str);
                 break;                  break;
         }          }
   
         tbl_char(tp, ASCII_NBRSP, padl);          tbl_char(tp, ASCII_NBRSP, padl);
         term_word(tp, dp->string);          term_word(tp, str);
         tbl_char(tp, ASCII_NBRSP, padr);          tbl_char(tp, ASCII_NBRSP, padr);
 }  }
   
Line 391  tbl_number(struct termp *tp, const struct tbl *tbl,
Line 394  tbl_number(struct termp *tp, const struct tbl *tbl,
          * and the maximum decimal; right-pad by the remaining amount.           * and the maximum decimal; right-pad by the remaining amount.
          */           */
   
         str = "";          str = dp && dp->string ? dp->string : "";
         if (dp->string)  
                 str = dp->string;  
   
         sz = term_strlen(tp, str);          sz = term_strlen(tp, str);
   
Line 418  tbl_number(struct termp *tp, const struct tbl *tbl,
Line 419  tbl_number(struct termp *tp, const struct tbl *tbl,
         padl = col->decimal - d;          padl = col->decimal - d;
   
         tbl_char(tp, ASCII_NBRSP, padl);          tbl_char(tp, ASCII_NBRSP, padl);
         term_word(tp, dp->string);          term_word(tp, str);
         tbl_char(tp, ASCII_NBRSP, col->width - sz - padl);          tbl_char(tp, ASCII_NBRSP, col->width - sz - padl);
 }  }
   

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

CVSweb