version 1.17, 2011/01/10 14:56:06 |
version 1.19, 2011/01/25 12:07:30 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> |
* Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@kth.se> |
|
* Copyright (c) 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 197 tbl_hrule(struct termp *tp, const struct tbl_span *sp) |
|
Line 198 tbl_hrule(struct termp *tp, const struct tbl_span *sp) |
|
width = tp->tbl.cols[hp->ident].width; |
width = tp->tbl.cols[hp->ident].width; |
switch (hp->pos) { |
switch (hp->pos) { |
case (TBL_HEAD_DATA): |
case (TBL_HEAD_DATA): |
|
if (hp->next) |
|
width += 2; |
tbl_char(tp, c, width); |
tbl_char(tp, c, width); |
break; |
break; |
case (TBL_HEAD_DVERT): |
case (TBL_HEAD_DVERT): |
Line 305 tbl_data(struct termp *tp, const struct tbl *tbl, |
|
Line 308 tbl_data(struct termp *tp, const struct tbl *tbl, |
|
case (TBL_CELL_NUMBER): |
case (TBL_CELL_NUMBER): |
tbl_number(tp, tbl, dp, col); |
tbl_number(tp, tbl, dp, col); |
break; |
break; |
|
case (TBL_CELL_DOWN): |
|
tbl_char(tp, ASCII_NBRSP, col->width); |
|
break; |
default: |
default: |
abort(); |
abort(); |
/* NOTREACHED */ |
/* NOTREACHED */ |
Line 368 tbl_literal(struct termp *tp, const struct tbl_dat *dp |
|
Line 374 tbl_literal(struct termp *tp, const struct tbl_dat *dp |
|
padr = col->width - term_strlen(tp, dp->string) - ssz; |
padr = col->width - term_strlen(tp, dp->string) - ssz; |
break; |
break; |
case (TBL_CELL_CENTRE): |
case (TBL_CELL_CENTRE): |
padl = col->width - term_strlen(tp, dp->string); |
padr = col->width - term_strlen(tp, dp->string); |
if (padl % 2) |
if (3 > padr) |
padr++; |
break; |
padl /= 2; |
padl = (padr - 1) / 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, dp->string); |
Line 384 tbl_literal(struct termp *tp, const struct tbl_dat *dp |
|
Line 390 tbl_literal(struct termp *tp, const struct tbl_dat *dp |
|
|
|
tbl_char(tp, ASCII_NBRSP, padl); |
tbl_char(tp, ASCII_NBRSP, padl); |
term_word(tp, dp->string); |
term_word(tp, dp->string); |
tbl_char(tp, ASCII_NBRSP, padr); |
tbl_char(tp, ASCII_NBRSP, padr + 2); |
} |
} |
|
|
static void |
static void |