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

Diff for /mandoc/term.c between version 1.258 and 1.261

version 1.258, 2016/08/10 11:03:43 version 1.261, 2017/06/01 19:05:37
Line 1 
Line 1 
 /*      $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>   * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010-2016 Ingo Schwarze <schwarze@openbsd.org>   * Copyright (c) 2010-2017 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 141  term_flushln(struct termp *p)
Line 141  term_flushln(struct termp *p)
                  * subsequent tabs into a single huge set of spaces.                   * subsequent tabs into a single huge set of spaces.
                  */                   */
                 ntab = 0;                  ntab = 0;
                 while (i < p->col && '\t' == p->buf[i]) {                  while (i < p->col && p->buf[i] == '\t') {
                         vend = (vis / p->tabwidth + 1) * p->tabwidth;                          vend = term_tab_next(vis);
                         vbl += vend - vis;                          vbl += vend - vis;
                         vis = vend;                          vis = vend;
                         ntab++;                          ntab++;
Line 192  term_flushln(struct termp *p)
Line 192  term_flushln(struct termp *p)
                         vend -= vis;                          vend -= vis;
                         (*p->endline)(p);                          (*p->endline)(p);
                         p->viscol = 0;                          p->viscol = 0;
                         if (TERMP_BRIND & p->flags) {  
                                 vbl = p->rmargin;  
                                 vend += p->rmargin;  
                                 vend -= p->offset;  
                         } else  
                                 vbl = p->offset;  
   
                         /* use pending tabs on the new line */                          /* Use pending tabs on the new line. */
   
                         if (0 < ntab)                          vbl = 0;
                                 vbl += ntab * p->tabwidth;                          while (ntab--)
                                   vbl = term_tab_next(vbl);
   
                           /* Re-establish indentation. */
   
                           if (p->flags & TERMP_BRIND) {
                                   vbl += p->rmargin;
                                   vend += p->rmargin - p->offset;
                           } else
                                   vbl += p->offset;
   
                         /*                          /*
                          * Remove the p->overstep width.                           * Remove the p->overstep width.
                          * Again, if p->overstep is negative,                           * Again, if p->overstep is negative,
Line 397  term_fontpop(struct termp *p)
Line 400  term_fontpop(struct termp *p)
 void  void
 term_word(struct termp *p, const char *word)  term_word(struct termp *p, const char *word)
 {  {
           struct roffsu    su;
         const char       nbrsp[2] = { ASCII_NBRSP, 0 };          const char       nbrsp[2] = { ASCII_NBRSP, 0 };
         const char      *seq, *cp;          const char      *seq, *cp;
         int              sz, uc;          int              sz, uc;
Line 485  term_word(struct termp *p, const char *word)
Line 489  term_word(struct termp *p, const char *word)
                         else if (*word == '\0')                          else if (*word == '\0')
                                 p->flags |= (TERMP_NOSPACE | TERMP_NONEWLINE);                                  p->flags |= (TERMP_NOSPACE | TERMP_NONEWLINE);
                         continue;                          continue;
                   case ESCAPE_HORIZ:
                           if (a2roffsu(seq, &su, SCALE_EM) == 0)
                                   continue;
                           uc = term_hspan(p, &su) / 24;
                           if (uc > 0)
                                   while (uc-- > 0)
                                           bufferc(p, ASCII_NBRSP);
                           else if (p->col > (size_t)(-uc))
                                   p->col += uc;
                           else {
                                   uc += p->col;
                                   p->col = 0;
                                   if (p->offset > (size_t)(-uc)) {
                                           p->ti += uc;
                                           p->offset += uc;
                                   } else {
                                           p->ti -= p->offset;
                                           p->offset = 0;
                                   }
                           }
                           continue;
                 case ESCAPE_SKIPCHAR:                  case ESCAPE_SKIPCHAR:
                         p->flags |= TERMP_BACKAFTER;                          p->flags |= TERMP_BACKAFTER;
                         continue;                          continue;
Line 606  encode(struct termp *p, const char *word, size_t sz)
Line 631  encode(struct termp *p, const char *word, size_t sz)
                 if (ASCII_HYPH == word[i] ||                  if (ASCII_HYPH == word[i] ||
                     isgraph((unsigned char)word[i]))                      isgraph((unsigned char)word[i]))
                         encode1(p, word[i]);                          encode1(p, word[i]);
                 else                  else {
                         p->buf[p->col++] = word[i];                          p->buf[p->col++] = word[i];
   
                           /*
                            * Postpone the effect of \z while handling
                            * an overstrike sequence from ascii_uc2str().
                            */
   
                           if (word[i] == '\b' &&
                               (p->flags & TERMP_BACKBEFORE)) {
                                   p->flags &= ~TERMP_BACKBEFORE;
                                   p->flags |= TERMP_BACKAFTER;
                           }
                   }
         }          }
 }  }
   

Legend:
Removed from v.1.258  
changed lines
  Added in v.1.261

CVSweb