summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2021-05-15 17:19:04 +0000
committerIngo Schwarze <schwarze@openbsd.org>2021-05-15 17:19:04 +0000
commite423fd0bcabdf280084ef41611c320fd29821fd2 (patch)
treee6f70a2bccf132d6ad5dbf806568c64a1c94771c
parent9612983eb1a1d2d745462a4075bd2175d3e1411d (diff)
downloadmandoc-e423fd0bcabdf280084ef41611c320fd29821fd2.tar.gz
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.
-rw-r--r--tbl_data.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/tbl_data.c b/tbl_data.c
index c734c070..5ee32430 100644
--- a/tbl_data.c
+++ b/tbl_data.c
@@ -244,10 +244,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') {