logo

etc_portage

Unnamed repository; edit this file 'description' to name the repository.

tbl_term.c_1.70_1.73.patch (7627B)


      1 ===================================================================
      2 RCS file: /cvs/mandoc/tbl_term.c,v
      3 retrieving revision 1.68
      4 retrieving revision 1.73
      5 diff -u -p -r1.68 -r1.73
      6 --- mandoc/tbl_term.c	2019/02/09 21:02:47	1.68
      7 +++ mandoc/tbl_term.c	2020/01/11 16:26:08	1.73
      8 @@ -1,7 +1,7 @@
      9 -/*	$Id: tbl_term.c,v 1.68 2019/02/09 21:02:47 schwarze Exp $ */
     10 +/*	$Id: tbl_term.c,v 1.73 2020/01/11 16:26:08 schwarze Exp $ */
     11  /*
     12   * Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
     13 - * Copyright (c) 2011-2019 Ingo Schwarze <schwarze@openbsd.org>
     14 + * Copyright (c) 2011-2020 Ingo Schwarze <schwarze@openbsd.org>
     15   *
     16   * Permission to use, copy, modify, and distribute this software for any
     17   * purpose with or without fee is hereby granted, provided that the above
     18 @@ -46,7 +46,8 @@ static	void	tbl_fill_border(struct termp *, int, size_
     19  static	void	tbl_fill_char(struct termp *, char, size_t);
     20  static	void	tbl_fill_string(struct termp *, const char *, size_t);
     21  static	void	tbl_hrule(struct termp *, const struct tbl_span *,
     22 -			const struct tbl_span *, int);
     23 +			const struct tbl_span *, const struct tbl_span *,
     24 +			int);
     25  static	void	tbl_literal(struct termp *, const struct tbl_dat *,
     26  			const struct roffcol *);
     27  static	void	tbl_number(struct termp *, const struct tbl_opts *,
     28 @@ -163,7 +164,7 @@ term_tbl(struct termp *tp, const struct tbl_span *sp)
     29  	const struct tbl_cell	*cp, *cpn, *cpp, *cps;
     30  	const struct tbl_dat	*dp;
     31  	static size_t		 offset;
     32 -	size_t		 	 save_offset;
     33 +	size_t			 save_offset;
     34  	size_t			 coloff, tsz;
     35  	int			 hspans, ic, more;
     36  	int			 dvert, fc, horiz, lhori, rhori, uvert;
     37 @@ -222,9 +223,9 @@ term_tbl(struct termp *tp, const struct tbl_span *sp)
     38  
     39  		if (tp->enc == TERMENC_ASCII &&
     40  		    sp->opts->opts & TBL_OPT_DBOX)
     41 -			tbl_hrule(tp, NULL, sp, TBL_OPT_DBOX);
     42 +			tbl_hrule(tp, NULL, sp, sp, TBL_OPT_DBOX);
     43  		if (sp->opts->opts & (TBL_OPT_DBOX | TBL_OPT_BOX))
     44 -			tbl_hrule(tp, NULL, sp, TBL_OPT_BOX);
     45 +			tbl_hrule(tp, NULL, sp, sp, TBL_OPT_BOX);
     46  	}
     47  
     48  	/* Set up the columns. */
     49 @@ -266,11 +267,11 @@ term_tbl(struct termp *tp, const struct tbl_span *sp)
     50  				hspans--;
     51  				continue;
     52  			}
     53 -			if (dp == NULL)
     54 -				continue;
     55 -			hspans = dp->hspans;
     56 -			if (ic || sp->layout->first->pos != TBL_CELL_SPAN)
     57 +			if (dp != NULL &&
     58 +			    (ic || sp->layout->first->pos != TBL_CELL_SPAN)) {
     59 +				hspans = dp->hspans;
     60  				dp = dp->next;
     61 +			}
     62  		}
     63  
     64  		/* Set up a column for a right vertical frame. */
     65 @@ -301,11 +302,11 @@ term_tbl(struct termp *tp, const struct tbl_span *sp)
     66  			tp->tcol++;
     67  			tp->col = 0;
     68  			tbl_data(tp, sp->opts, cp, dp, tp->tbl.cols + ic);
     69 -			if (dp == NULL)
     70 -				continue;
     71 -			hspans = dp->hspans;
     72 -			if (cp->pos != TBL_CELL_SPAN)
     73 +			if (dp != NULL &&
     74 +			    (ic || sp->layout->first->pos != TBL_CELL_SPAN)) {
     75 +				hspans = dp->hspans;
     76  				dp = dp->next;
     77 +			}
     78  		}
     79  		break;
     80  	}
     81 @@ -342,7 +343,7 @@ term_tbl(struct termp *tp, const struct tbl_span *sp)
     82  
     83  		more = 0;
     84  		if (horiz)
     85 -			tbl_hrule(tp, sp->prev, sp, 0);
     86 +			tbl_hrule(tp, sp->prev, sp, sp->next, 0);
     87  		else {
     88  			cp = sp->layout->first;
     89  			cpn = sp->next == NULL ? NULL :
     90 @@ -424,11 +425,10 @@ term_tbl(struct termp *tp, const struct tbl_span *sp)
     91  					cp = cp->next;
     92  					continue;
     93  				}
     94 -				if (dp != NULL) {
     95 +				if (dp != NULL && (ic ||
     96 +				    sp->layout->first->pos != TBL_CELL_SPAN)) {
     97  					hspans = dp->hspans;
     98 -					if (ic || sp->layout->first->pos
     99 -					    != TBL_CELL_SPAN)
    100 -						dp = dp->next;
    101 +					dp = dp->next;
    102  				}
    103  
    104  				/*
    105 @@ -557,12 +557,12 @@ term_tbl(struct termp *tp, const struct tbl_span *sp)
    106  	tp->tcol->rmargin = tp->maxrmargin;
    107  	if (sp->next == NULL) {
    108  		if (sp->opts->opts & (TBL_OPT_DBOX | TBL_OPT_BOX)) {
    109 -			tbl_hrule(tp, sp, NULL, TBL_OPT_BOX);
    110 +			tbl_hrule(tp, sp, sp, NULL, TBL_OPT_BOX);
    111  			tp->skipvsp = 1;
    112  		}
    113  		if (tp->enc == TERMENC_ASCII &&
    114  		    sp->opts->opts & TBL_OPT_DBOX) {
    115 -			tbl_hrule(tp, sp, NULL, TBL_OPT_DBOX);
    116 +			tbl_hrule(tp, sp, sp, NULL, TBL_OPT_DBOX);
    117  			tp->skipvsp = 2;
    118  		}
    119  		assert(tp->tbl.cols);
    120 @@ -571,7 +571,7 @@ term_tbl(struct termp *tp, const struct tbl_span *sp)
    121  	} else if (horiz == 0 && sp->opts->opts & TBL_OPT_ALLBOX &&
    122  	    (sp->next == NULL || sp->next->pos == TBL_SPAN_DATA ||
    123  	     sp->next->next != NULL))
    124 -		tbl_hrule(tp, sp, sp->next, TBL_OPT_ALLBOX);
    125 +		tbl_hrule(tp, sp, sp, sp->next, TBL_OPT_ALLBOX);
    126  
    127  	tp->tcol->offset = save_offset;
    128  	tp->flags &= ~TERMP_NONOSPACE;
    129 @@ -579,9 +579,10 @@ term_tbl(struct termp *tp, const struct tbl_span *sp)
    130  
    131  static void
    132  tbl_hrule(struct termp *tp, const struct tbl_span *spp,
    133 -    const struct tbl_span *spn, int flags)
    134 +    const struct tbl_span *sp, const struct tbl_span *spn, int flags)
    135  {
    136  	const struct tbl_cell	*cpp;    /* Layout cell above this line. */
    137 +	const struct tbl_cell	*cp;     /* Layout cell in this line. */
    138  	const struct tbl_cell	*cpn;    /* Layout cell below this line. */
    139  	const struct tbl_dat	*dpn;	 /* Data cell below this line. */
    140  	const struct roffcol	*col;    /* Contains width and spacing. */
    141 @@ -592,6 +593,7 @@ tbl_hrule(struct termp *tp, const struct tbl_span *spp
    142  	int			 uw, dw; /* Vertical line widths. */
    143  
    144  	cpp = spp == NULL ? NULL : spp->layout->first;
    145 +	cp  = sp  == NULL ? NULL : sp->layout->first;
    146  	cpn = spn == NULL ? NULL : spn->layout->first;
    147  	dpn = NULL;
    148  	if (spn != NULL) {
    149 @@ -600,11 +602,11 @@ tbl_hrule(struct termp *tp, const struct tbl_span *spp
    150  		else if (spn->next != NULL)
    151  			dpn = spn->next->first;
    152  	}
    153 -	opts = spn == NULL ? spp->opts->opts : spn->opts->opts;
    154 +	opts = sp->opts->opts;
    155  	bw = opts & TBL_OPT_DBOX ? (tp->enc == TERMENC_UTF8 ? 2 : 1) :
    156  	    opts & (TBL_OPT_BOX | TBL_OPT_ALLBOX) ? 1 : 0;
    157  	hw = flags == TBL_OPT_DBOX || flags == TBL_OPT_BOX ? bw :
    158 -	    spn->pos == TBL_SPAN_DHORIZ ? 2 : 1;
    159 +	    sp->pos == TBL_SPAN_DHORIZ ? 2 : 1;
    160  
    161  	/* Print the left end of the line. */
    162  
    163 @@ -619,14 +621,19 @@ tbl_hrule(struct termp *tp, const struct tbl_span *spp
    164  		    (spp == NULL || cpn == NULL ||
    165  		     cpn->pos != TBL_CELL_DOWN ? BRIGHT * hw : 0), 1);
    166  
    167 +	col = tp->tbl.cols;
    168  	for (;;) {
    169 -		col = tp->tbl.cols + (cpn == NULL ? cpp->col : cpn->col);
    170 +		if (cp == NULL)
    171 +			col++;
    172 +		else
    173 +			col = tp->tbl.cols + cp->col;
    174  
    175  		/* Print the horizontal line inside this column. */
    176  
    177  		lw = cpp == NULL || cpn == NULL ||
    178  		    (cpn->pos != TBL_CELL_DOWN &&
    179 -		     (dpn == NULL || strcmp(dpn->string, "\\^") != 0))
    180 +		     (dpn == NULL || dpn->string == NULL ||
    181 +		      strcmp(dpn->string, "\\^") != 0))
    182  		    ? hw : 0;
    183  		tbl_direct_border(tp, BHORIZ * lw,
    184  		    col->width + col->spacing / 2);
    185 @@ -645,7 +652,10 @@ tbl_hrule(struct termp *tp, const struct tbl_span *spp
    186  					uw = 1;
    187  			}
    188  			cpp = cpp->next;
    189 -		}
    190 +		} else if (spp != NULL && opts & TBL_OPT_ALLBOX)
    191 +			uw = 1;
    192 +		if (cp != NULL)
    193 +			cp = cp->next;
    194  		if (cpn != NULL) {
    195  			if (flags != TBL_OPT_DBOX) {
    196  				dw = cpn->vert;
    197 @@ -655,8 +665,9 @@ tbl_hrule(struct termp *tp, const struct tbl_span *spp
    198  			cpn = cpn->next;
    199  			while (dpn != NULL && dpn->layout != cpn)
    200  				dpn = dpn->next;
    201 -		}
    202 -		if (cpp == NULL && cpn == NULL)
    203 +		} else if (spn != NULL && opts & TBL_OPT_ALLBOX)
    204 +			dw = 1;
    205 +		if (col + 1 == tp->tbl.cols + sp->opts->cols)
    206  			break;
    207  
    208  		/* Vertical lines do not cross spanned cells. */
    209 @@ -670,7 +681,8 @@ tbl_hrule(struct termp *tp, const struct tbl_span *spp
    210  
    211  		rw = cpp == NULL || cpn == NULL ||
    212  		    (cpn->pos != TBL_CELL_DOWN &&
    213 -		     (dpn == NULL || strcmp(dpn->string, "\\^") != 0))
    214 +		     (dpn == NULL || dpn->string == NULL ||
    215 +		      strcmp(dpn->string, "\\^") != 0))
    216  		    ? hw : 0;
    217  
    218  		/* The line crossing at the end of this column. */