diff options
-rw-r--r-- | mandoc.h | 5 | ||||
-rw-r--r-- | tbl.c | 3 | ||||
-rw-r--r-- | tbl_data.c | 6 | ||||
-rw-r--r-- | tbl_layout.c | 2 |
4 files changed, 15 insertions, 1 deletions
@@ -250,9 +250,14 @@ enum tbl_spant { * A row of data in a table. */ struct tbl_span { + struct tbl *tbl; + struct tbl_head *head; struct tbl_row *layout; /* layout row: CAN BE NULL */ struct tbl_dat *first; struct tbl_dat *last; + int flags; +#define TBL_SPAN_FIRST (1 << 0) +#define TBL_SPAN_LAST (1 << 1) enum tbl_spant pos; struct tbl_span *next; }; @@ -153,6 +153,9 @@ tbl_end(struct tbl_node *tbl) TBL_MSG(tbl, MANDOCERR_TBLNODATA, tbl->line, tbl->pos); else tbl_calc(tbl); + + if (tbl->last_span) + tbl->last_span->flags |= TBL_SPAN_LAST; } static void @@ -114,13 +114,17 @@ tbl_data(struct tbl_node *tbl, int ln, const char *p) rp = tbl->first_row; dp = mandoc_calloc(1, sizeof(struct tbl_span)); + dp->tbl = &tbl->opts; dp->layout = rp; + dp->head = tbl->first_head; if (tbl->last_span) { tbl->last_span->next = dp; tbl->last_span = dp; - } else + } else { tbl->last_span = tbl->first_span = dp; + dp->flags |= TBL_SPAN_FIRST; + } if ( ! strcmp(p, "_")) { dp->pos = TBL_SPAN_HORIZ; diff --git a/tbl_layout.c b/tbl_layout.c index ecb7e508..b01b521c 100644 --- a/tbl_layout.c +++ b/tbl_layout.c @@ -322,6 +322,8 @@ cell_alloc(struct tbl_node *tbl, struct tbl_row *rp, enum tbl_cellt pos) hp->prev = h->prev; if (h->prev) h->prev->next = hp; + if (h == tbl->first_head) + tbl->first_head = hp; h->prev = hp; hp->next = h; head_adjust(p, hp); |