From: schwarze Date: Sat, 15 May 2021 17:16:38 +0000 (+0000) Subject: When looking for the last layout row used, we need to look at the layout X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=61deec73702a13f8367b0787f5f4aa359abc9094;p=openbsd When looking for the last layout row used, we need to look at the layout row used for the previous data line containing data, not at the previous data line outright, which might be a horizontal ruler. If it is, do not restart from the first layout row but still proceed to the next data row, which may have been just read from T&. Bug originally reported by Oliver dot Corff at email dot de on groff at gnu dot org: https://lists.gnu.org/archive/html/groff/2021-03/msg00003.html and forwarded to me by bentley@. Patch OK'ed by bentley@ back in April. --- diff --git a/usr.bin/mandoc/tbl_data.c b/usr.bin/mandoc/tbl_data.c index b2556d9b22d..11b0a9191db 100644 --- a/usr.bin/mandoc/tbl_data.c +++ b/usr.bin/mandoc/tbl_data.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tbl_data.c,v 1.40 2020/01/11 20:48:13 schwarze Exp $ */ +/* $OpenBSD: tbl_data.c,v 1.41 2021/05/15 17:16:38 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2011,2015,2017,2018,2019 Ingo Schwarze @@ -242,10 +242,11 @@ tbl_data(struct tbl_node *tbl, int ln, const char *p, int pos) 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') {