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

Diff for /mandoc/man_term.c between version 1.93 and 1.94

version 1.93, 2011/01/03 15:30:25 version 1.94, 2011/01/04 01:23:18
Line 1 
Line 1 
 /*      $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>   * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
    * Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above   * purpose with or without fee is hereby granted, provided that the above
Line 513  pre_IP(DECL_ARGS)
Line 514  pre_IP(DECL_ARGS)
 {  {
         const struct man_node   *nn;          const struct man_node   *nn;
         size_t                   len;          size_t                   len;
         int                      ival;          int                      savelit, ival;
   
         switch (n->type) {          switch (n->type) {
         case (MAN_BODY):          case (MAN_BODY):
Line 533  pre_IP(DECL_ARGS)
Line 534  pre_IP(DECL_ARGS)
         len = mt->lmargin;          len = mt->lmargin;
         ival = -1;          ival = -1;
   
         /* Calculate offset. */          /* Calculate the offset from the optional second argument. */
   
         if (NULL != (nn = n->parent->head->child))          if (NULL != (nn = n->parent->head->child))
                 if (NULL != (nn = nn->next)) {                  if (NULL != (nn = nn->next))
                         for ( ; nn->next; nn = nn->next)  
                                 /* Do nothing. */ ;  
                         if ((ival = a2width(p, nn->string)) >= 0)                          if ((ival = a2width(p, nn->string)) >= 0)
                                 len = (size_t)ival;                                  len = (size_t)ival;
                 }  
   
         switch (n->type) {          switch (n->type) {
         case (MAN_HEAD):          case (MAN_HEAD):
Line 557  pre_IP(DECL_ARGS)
Line 554  pre_IP(DECL_ARGS)
                 /* Set the saved left-margin. */                  /* Set the saved left-margin. */
                 mt->lmargin = (size_t)ival;                  mt->lmargin = (size_t)ival;
   
                 /* Don't print the length value. */                  savelit = MANT_LITERAL & mt->fl;
                 for (nn = n->child; nn->next; nn = nn->next)                  mt->fl &= ~MANT_LITERAL;
                         print_man_node(p, mt, nn, m);  
                   if (n->child)
                           print_man_node(p, mt, n->child, m);
   
                   if (savelit)
                           mt->fl |= MANT_LITERAL;
   
                 return(0);                  return(0);
         case (MAN_BODY):          case (MAN_BODY):
                 p->offset = mt->offset + len;                  p->offset = mt->offset + len;
Line 585  post_IP(DECL_ARGS)
Line 588  post_IP(DECL_ARGS)
                 p->rmargin = p->maxrmargin;                  p->rmargin = p->maxrmargin;
                 break;                  break;
         case (MAN_BODY):          case (MAN_BODY):
                 term_flushln(p);                  term_newln(p);
                 p->flags &= ~TERMP_NOLPAD;                  p->flags &= ~TERMP_NOLPAD;
                 break;                  break;
         default:          default:
Line 600  pre_TP(DECL_ARGS)
Line 603  pre_TP(DECL_ARGS)
 {  {
         const struct man_node   *nn;          const struct man_node   *nn;
         size_t                   len;          size_t                   len;
         int                      ival;          int                      savelit, ival;
   
         switch (n->type) {          switch (n->type) {
         case (MAN_HEAD):          case (MAN_HEAD):
                 p->flags |= TERMP_NOBREAK;                  p->flags |= TERMP_NOBREAK;
                 p->flags |= TERMP_TWOSPACE;  
                 break;                  break;
         case (MAN_BODY):          case (MAN_BODY):
                 p->flags |= TERMP_NOLPAD;                  p->flags |= TERMP_NOLPAD;
Line 640  pre_TP(DECL_ARGS)
Line 642  pre_TP(DECL_ARGS)
                 p->offset = mt->offset;                  p->offset = mt->offset;
                 p->rmargin = mt->offset + len;                  p->rmargin = mt->offset + len;
   
                   savelit = MANT_LITERAL & mt->fl;
                   mt->fl &= ~MANT_LITERAL;
   
                 /* Don't print same-line elements. */                  /* Don't print same-line elements. */
                 for (nn = n->child; nn; nn = nn->next)                  for (nn = n->child; nn; nn = nn->next)
                         if (nn->line > n->line)                          if (nn->line > n->line)
                                 print_man_node(p, mt, nn, m);                                  print_man_node(p, mt, nn, m);
   
                   if (savelit)
                           mt->fl |= MANT_LITERAL;
   
                 if (ival >= 0)                  if (ival >= 0)
                         mt->lmargin = (size_t)ival;                          mt->lmargin = (size_t)ival;
   
Line 674  post_TP(DECL_ARGS)
Line 682  post_TP(DECL_ARGS)
                 p->rmargin = p->maxrmargin;                  p->rmargin = p->maxrmargin;
                 break;                  break;
         case (MAN_BODY):          case (MAN_BODY):
                 term_flushln(p);                  term_newln(p);
                 p->flags &= ~TERMP_NOLPAD;                  p->flags &= ~TERMP_NOLPAD;
                 break;                  break;
         default:          default:
Line 861  print_man_node(DECL_ARGS)
Line 869  print_man_node(DECL_ARGS)
                         p->rmargin = p->maxrmargin = TERM_MAXMARGIN;                          p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
                         p->flags |= TERMP_NOSPACE;                          p->flags |= TERMP_NOSPACE;
                         term_flushln(p);                          term_flushln(p);
                           p->flags &= ~TERMP_NOLPAD;
                         p->rmargin = rm;                          p->rmargin = rm;
                         p->maxrmargin = rmax;                          p->maxrmargin = rmax;
                 }                  }

Legend:
Removed from v.1.93  
changed lines
  Added in v.1.94

CVSweb