=================================================================== RCS file: /cvs/mandoc/tbl_data.c,v retrieving revision 1.52 retrieving revision 1.54 diff -u -p -r1.52 -r1.54 --- mandoc/tbl_data.c 2019/02/09 16:00:39 1.52 +++ mandoc/tbl_data.c 2021/05/15 17:19:04 1.54 @@ -1,4 +1,4 @@ -/* $Id: tbl_data.c,v 1.52 2019/02/09 16:00:39 schwarze Exp $ */ +/* $Id: tbl_data.c,v 1.54 2021/05/15 17:19:04 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2011,2015,2017,2018,2019 Ingo Schwarze @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -73,6 +74,7 @@ getdata(struct tbl_node *tbl, struct tbl_span *dp, if (dp->layout->last->col + 1 < dp->opts->cols) { cp = mandoc_calloc(1, sizeof(*cp)); cp->pos = TBL_CELL_LEFT; + cp->spacing = SIZE_MAX; dp->layout->last->next = cp; cp->col = dp->layout->last->col + 1; dp->layout->last = cp; @@ -242,10 +244,11 @@ tbl_data(struct tbl_node *tbl, int ln, const char *p, struct tbl_cell *cp; struct tbl_span *sp; - rp = (sp = tbl->last_span) == NULL ? tbl->first_row : - sp->pos == TBL_SPAN_DATA && sp->layout->next != NULL ? - sp->layout->next : sp->layout; - + for (sp = tbl->last_span; sp != NULL; sp = sp->prev) + if (sp->pos == TBL_SPAN_DATA) + break; + rp = sp == NULL ? tbl->first_row : + sp->layout->next == NULL ? sp->layout : sp->layout->next; assert(rp != NULL); if (p[1] == '\0') {