- /*
- * Work around groff's column handling. The offset is
- * equal to the sum of all widths leading to the current
- * column (plus the -offset value). If this column
- * exceeds the stated number of columns, the width is
- * set as 0, else it's the stated column width (later
- * the 0 will be adjusted to default 10 or, if in the
- * last column case, set to stretch to the margin).
+ /*
+ * Imitate groff's column handling:
+ * - For each earlier column, add its width.
+ * - For less than 5 columns, add four more blanks per
+ * column.
+ * - For exactly 5 columns, add three more blank per
+ * column.
+ * - For more than 5 columns, add only one column.
+ */
+ ncols = bl->args->argv[vals[2]].sz;
+ /* LINTED */
+ dcol = ncols < 5 ? 4 : ncols == 5 ? 3 : 1;
+
+ /*
+ * Calculate the offset by applying all prior MDOC_BODY,
+ * so we stop at the MDOC_HEAD (NULL == nn->prev).