- if (p->flags & TERMP_NOBREAK) {
- if ( ! (TERMP_DANGLE & p->flags))
- for ( ; vis < maxvis; vis++)
- putchar(' ');
- } else
- putchar('\n');
+ /*
+ * Behave exactly the same way as groff:
+ * If we have overstepped the margin, temporarily move
+ * it to the right and flag the rest of the line to be
+ * shorter.
+ * If we landed right at the margin, be happy.
+ * If we are one step before the margin, temporarily
+ * move it one step LEFT and flag the rest of the line
+ * to be longer.
+ */
+ if (overstep >= -1) {
+ assert((int)maxvis + overstep >= 0);
+ /* LINTED */
+ maxvis += overstep;
+ } else
+ overstep = 0;
+
+ } else if (TERMP_DANGLE & p->flags)
+ return;