summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mandoc.h5
-rw-r--r--tbl.c3
-rw-r--r--tbl_data.c6
-rw-r--r--tbl_layout.c2
4 files changed, 15 insertions, 1 deletions
diff --git a/mandoc.h b/mandoc.h
index 8553a8dd..ffd9159f 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -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;
};
diff --git a/tbl.c b/tbl.c
index 57b8135b..79220448 100644
--- a/tbl.c
+++ b/tbl.c
@@ -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
diff --git a/tbl_data.c b/tbl_data.c
index 9c59f6be..dd71d067 100644
--- a/tbl_data.c
+++ b/tbl_data.c
@@ -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);