output: Add footnote support.
[pspp] / tests / output / render.at
index 471aefcf0024c3bf280c51754121a811e2980744..9aaef8cf8e702b3f8ca6d7ef9f9b2c0d1adc223c 100644 (file)
@@ -1,5 +1,18 @@
-m4_define([RENDER_WEAVE_6X6],
-  [AT_DATA([input], [6 6 $1
+# +-+---+-+-+-+
+# |a|bcd|e|f|i|
+# +-+-+-+-+g+-+
+# |j|m|nop|h|q|
+# |k+-+-+-+-+r|
+# |l|t|w|xyz|s|
+# +-+u+-+-+-+-+
+# |A|v|B|E|FGH|
+# +-+-+C+-+-+-+
+# |IJK|D|L|O|P|
+# +-+-+-+M+-+-+
+# |Q|RST|N|U|V|
+# +-+---+-+-+-+
+m4_define([WEAVE_6X6],
+  [6 6 $1
 @a
 1*2 @bcd
 @e
@@ -24,10 +37,27 @@ m4_define([RENDER_WEAVE_6X6],
 1*2 @RST
 @U
 @V
-])])
+])
 
-m4_define([RENDER_8X8],
-  [AT_DATA([input], [8 8 $1
+# +-+-+-+-+-+-+-+-+
+# |a|b|c|d|e|f|g|h|
+# +-+-+-+-+-+-+-+-+
+# |i|jkl|m|nop|q|t|
+# +-+-+-+-+-+-+r+-+
+# |u|v|wxy|z|A|s|D|
+# +-+-+-+-+-+B+-+-+
+# |E|F|I|JKL|C|M|P|
+# +-+G+-+---+-+N+-+
+# |Q|H|R|UVW|X|O|Y|
+# +-+-+S+-+-+-+-+-+
+# |Z|0|T|3|456|7|8|
+# +-+1+-+-+-+-+-+-+
+# |9|2|abc|d|efg|h|
+# +-+-+-+-+-+-+-+-+
+# |i|j|k|l|m|n|o|p|
+# +-+-+-+-+-+-+-+-+
+m4_define([WEAVE_8X8],
+  [8 8 $1
 @a
 @b
 @c
@@ -78,7 +108,7 @@ m4_define([RENDER_8X8],
 @n
 @o
 @p
-])])
+])
 
 # This input is something of a counterexample, in that it could render
 # compactly as this if the algorithm for choosing cell widths and
@@ -101,8 +131,8 @@ m4_define([RENDER_8X8],
 # +---+-+RSTUV|456|
 # |abcde|WXYZ0|789|
 # +-----+-----+---+
-m4_define([RENDER_8X8_2],
-  [AT_DATA([input], [8 8 $1
+m4_define([WEAVE_8X8_2],
+  [8 8 $1
 2*2 @abc\ndef\nghi
 1*2 @jkl
 2*2 @mno\npqr\nstu
@@ -124,7 +154,7 @@ m4_define([RENDER_8X8_2],
 2*3 @MNOPQ\nRSTUV\nWXYZ0
 2*2 @123\n456\n789
 1*3 @abcde
-])])
+])
 \f
 AT_BANNER([output rendering -- no page breaking])
 
@@ -137,6 +167,17 @@ AT_CHECK([render-test input], [0], [abc
 ])
 AT_CLEANUP
 
+AT_SETUP([nested single cell])
+AT_KEYWORDS([render rendering])
+AT_DATA([input], [1 1
+abc
+1 1
+{0}
+])
+AT_CHECK([render-test input], [0], [abc
+])
+AT_CLEANUP
+
 AT_SETUP([single cell with border])
 AT_KEYWORDS([render rendering])
 AT_DATA([input], [1 1
@@ -149,6 +190,22 @@ AT_CHECK([render-test input], [0], [dnl
 ])
 AT_CLEANUP
 
+AT_SETUP([nested single cell with border])
+AT_KEYWORDS([render rendering])
+AT_DATA([input], [1 1
+@abc
+1 1
+@{0}
+])
+AT_CHECK([render-test input], [0], [dnl
++-----+
+|+---+|
+||abc||
+|+---+|
++-----+
+])
+AT_CLEANUP
+
 AT_SETUP([joined columns])
 AT_KEYWORDS([render rendering])
 AT_DATA([input], [2 2
@@ -185,9 +242,51 @@ AT_CHECK([render-test input], [0], [dnl
 ])
 AT_CLEANUP
 
+AT_SETUP([joined rows and columns (with footnotes)])
+AT_KEYWORDS([render rendering footnote])
+AT_DATA([input], [3 3
+1*2 @abc#Approximation.
+2*1 @d\ne\nf#This is a very long footnote that will have to wrap from one line to the next.  Let's see if the rendering engine does it acceptably.
+2*1 @g\nh\ni#One#Two#Three
+@j
+1*2 @klm
+])
+AT_CHECK([render-test --csv input], [0],
+[[+------------+----+
+|      abc[a]|   d|
++----------+-+   e|
+|         g|j|f[b]|
+|         h+-+----+
+|i[c][d][e]|   klm|
++----------+------+
+[a] Approximation.
+[b] This is a very long footnote that will have to wrap from one line to the
+    next.  Let's see if the rendering engine does it acceptably.
+[c] One
+[d] Two
+[e] Three
+]])
+AT_CHECK([cat render.csv], [0],
+[[abc[a],,"d
+e
+f[b]"
+"g
+h
+i[c][d][e]",j,
+,klm,
+
+Footnotes:
+a,Approximation.
+b,This is a very long footnote that will have to wrap from one line to the next.  Let's see if the rendering engine does it acceptably.
+c,One
+d,Two
+e,Three
+]])
+AT_CLEANUP
+
 AT_SETUP([6x6, joined rows and columns])
 AT_KEYWORDS([render rendering])
-RENDER_WEAVE_6X6
+AT_DATA([input], [WEAVE_6X6])
 AT_CHECK([render-test input], [0], [dnl
 +-+---+-+-+-+
 |a|bcd|e|f|i|
@@ -292,6 +391,26 @@ AT_CHECK([render-test input], [0], [dnl
 ])
 AT_CLEANUP
 
+AT_SETUP([nested joined rows])
+AT_KEYWORDS([render rendering])
+AT_DATA([input], [2 2
+2*1 @ab\ncd\nef
+@hij
+@klm
+1 1
+@{0}
+])
+AT_CHECK([render-test input], [0], [dnl
++--------+
+|+--+---+|
+||ab|hij||
+||cd+---+|
+||ef|klm||
+|+--+---+|
++--------+
+])
+AT_CLEANUP
+
 dnl This checks for bug #31346, a segmentation fault that surfaced
 dnl when two or more rows  had no unspanned cells and no rules.
 AT_SETUP([joined rows only, no rules])
@@ -407,7 +526,7 @@ AT_CLEANUP
 
 AT_SETUP([8x8 with many 2x2 joins])
 AT_KEYWORDS([render rendering])
-RENDER_8X8_2
+AT_DATA([input], [WEAVE_8X8_2])
 AT_CHECK([render-test input], [0],[dnl
 +---+---+----+----+
 |abc|jkl| mno| vwx|
@@ -433,6 +552,203 @@ AT_CHECK([render-test input], [0],[dnl
 +-----+------+----+
 ])
 AT_CLEANUP
+
+AT_SETUP([nested 8x8])
+AT_KEYWORDS([render rendering])
+AT_DATA([input], [WEAVE_8X8[]dnl
+1 1
+@{0}
+])
+AT_CHECK([render-test input], [0], [dnl
++-----------------+
+|+-+-+-+-+-+-+-+-+|
+||a|b|c|d|e|f|g|h||
+|+-+-+-+-+-+-+-+-+|
+||i|jkl|m|nop|q|t||
+|+-+-+-+-+-+-+r+-+|
+||u|v|wxy|z|A|s|D||
+|+-+-+-+-+-+B+-+-+|
+||E|F|I|JKL|C|M|P||
+|+-+G+-+---+-+N+-+|
+||Q|H|R|UVW|X|O|Y||
+|+-+-+S+-+-+-+-+-+|
+||Z|0|T|3|456|7|8||
+|+-+1+-+-+-+-+-+-+|
+||9|2|abc|d|efg|h||
+|+-+-+-+-+-+-+-+-+|
+||i|j|k|l|m|n|o|p||
+|+-+-+-+-+-+-+-+-+|
++-----------------+
+])
+AT_CLEANUP
+
+AT_SETUP([nested 8x8s and 6x6s])
+AT_KEYWORDS([render rendering])
+AT_DATA([input], [WEAVE_8X8[]WEAVE_6X6[]dnl
+4 2
+@{0}
+@{1}
+@{1}
+@|{1}
+@|{1}
+@({1}
+@({1}
+@{0}
+])
+AT_CHECK([render-test input], [0], [dnl
++-----------------+-----------------+
+|+-+-+-+-+-+-+-+-+|    +-+---+-+-+-+|
+||a|b|c|d|e|f|g|h||    |a|bcd|e|f|i||
+|+-+-+-+-+-+-+-+-+|    +-+-+-+-+g+-+|
+||i|jkl|m|nop|q|t||    |j|m|nop|h|q||
+|+-+-+-+-+-+-+r+-+|    |k+-+-+-+-+r||
+||u|v|wxy|z|A|s|D||    |l|t|w|xyz|s||
+|+-+-+-+-+-+B+-+-+|    +-+u+-+-+-+-+|
+||E|F|I|JKL|C|M|P||    |A|v|B|E|FGH||
+|+-+G+-+---+-+N+-+|    +-+-+C+-+-+-+|
+||Q|H|R|UVW|X|O|Y||    |IJK|D|L|O|P||
+|+-+-+S+-+-+-+-+-+|    +-+-+-+M+-+-+|
+||Z|0|T|3|456|7|8||    |Q|RST|N|U|V||
+|+-+1+-+-+-+-+-+-+|    +-+---+-+-+-+|
+||9|2|abc|d|efg|h||                 |
+|+-+-+-+-+-+-+-+-+|                 |
+||i|j|k|l|m|n|o|p||                 |
+|+-+-+-+-+-+-+-+-+|                 |
++-----------------+-----------------+
+|    +-+---+-+-+-+|  +-+---+-+-+-+  |
+|    |a|bcd|e|f|i||  |a|bcd|e|f|i|  |
+|    +-+-+-+-+g+-+|  +-+-+-+-+g+-+  |
+|    |j|m|nop|h|q||  |j|m|nop|h|q|  |
+|    |k+-+-+-+-+r||  |k+-+-+-+-+r|  |
+|    |l|t|w|xyz|s||  |l|t|w|xyz|s|  |
+|    +-+u+-+-+-+-+|  +-+u+-+-+-+-+  |
+|    |A|v|B|E|FGH||  |A|v|B|E|FGH|  |
+|    +-+-+C+-+-+-+|  +-+-+C+-+-+-+  |
+|    |IJK|D|L|O|P||  |IJK|D|L|O|P|  |
+|    +-+-+-+M+-+-+|  +-+-+-+M+-+-+  |
+|    |Q|RST|N|U|V||  |Q|RST|N|U|V|  |
+|    +-+---+-+-+-+|  +-+---+-+-+-+  |
++-----------------+-----------------+
+|  +-+---+-+-+-+  |+-+---+-+-+-+    |
+|  |a|bcd|e|f|i|  ||a|bcd|e|f|i|    |
+|  +-+-+-+-+g+-+  |+-+-+-+-+g+-+    |
+|  |j|m|nop|h|q|  ||j|m|nop|h|q|    |
+|  |k+-+-+-+-+r|  ||k+-+-+-+-+r|    |
+|  |l|t|w|xyz|s|  ||l|t|w|xyz|s|    |
+|  +-+u+-+-+-+-+  |+-+u+-+-+-+-+    |
+|  |A|v|B|E|FGH|  ||A|v|B|E|FGH|    |
+|  +-+-+C+-+-+-+  |+-+-+C+-+-+-+    |
+|  |IJK|D|L|O|P|  ||IJK|D|L|O|P|    |
+|  +-+-+-+M+-+-+  |+-+-+-+M+-+-+    |
+|  |Q|RST|N|U|V|  ||Q|RST|N|U|V|    |
+|  +-+---+-+-+-+  |+-+---+-+-+-+    |
++-----------------+-----------------+
+|+-+---+-+-+-+    |+-+-+-+-+-+-+-+-+|
+||a|bcd|e|f|i|    ||a|b|c|d|e|f|g|h||
+|+-+-+-+-+g+-+    |+-+-+-+-+-+-+-+-+|
+||j|m|nop|h|q|    ||i|jkl|m|nop|q|t||
+||k+-+-+-+-+r|    |+-+-+-+-+-+-+r+-+|
+||l|t|w|xyz|s|    ||u|v|wxy|z|A|s|D||
+|+-+u+-+-+-+-+    |+-+-+-+-+-+B+-+-+|
+||A|v|B|E|FGH|    ||E|F|I|JKL|C|M|P||
+|+-+-+C+-+-+-+    |+-+G+-+---+-+N+-+|
+||IJK|D|L|O|P|    ||Q|H|R|UVW|X|O|Y||
+|+-+-+-+M+-+-+    |+-+-+S+-+-+-+-+-+|
+||Q|RST|N|U|V|    ||Z|0|T|3|456|7|8||
+|+-+---+-+-+-+    |+-+1+-+-+-+-+-+-+|
+|                 ||9|2|abc|d|efg|h||
+|                 |+-+-+-+-+-+-+-+-+|
+|                 ||i|j|k|l|m|n|o|p||
+|                 |+-+-+-+-+-+-+-+-+|
++-----------------+-----------------+
+])
+AT_CLEANUP
+
+AT_SETUP([doubly nested cells])
+AT_KEYWORDS([render rendering])
+AT_DATA([input], [WEAVE_8X8[]WEAVE_6X6[]dnl
+4 2
+@{0}
+@{1}
+@{1}
+@|{1}
+@|{1}
+@({1}
+@({1}
+@{0}
+1 1
+@{2}
+])
+AT_CHECK([render-test input --length=70], [0], [dnl
++-------------------------------------+
+|+-----------------+-----------------+|
+||+-+-+-+-+-+-+-+-+|    +-+---+-+-+-+||
+|||a|b|c|d|e|f|g|h||    |a|bcd|e|f|i|||
+||+-+-+-+-+-+-+-+-+|    +-+-+-+-+g+-+||
+|||i|jkl|m|nop|q|t||    |j|m|nop|h|q|||
+||+-+-+-+-+-+-+r+-+|    |k+-+-+-+-+r|||
+|||u|v|wxy|z|A|s|D||    |l|t|w|xyz|s|||
+||+-+-+-+-+-+B+-+-+|    +-+u+-+-+-+-+||
+|||E|F|I|JKL|C|M|P||    |A|v|B|E|FGH|||
+||+-+G+-+---+-+N+-+|    +-+-+C+-+-+-+||
+|||Q|H|R|UVW|X|O|Y||    |IJK|D|L|O|P|||
+||+-+-+S+-+-+-+-+-+|    +-+-+-+M+-+-+||
+|||Z|0|T|3|456|7|8||    |Q|RST|N|U|V|||
+||+-+1+-+-+-+-+-+-+|    +-+---+-+-+-+||
+|||9|2|abc|d|efg|h||                 ||
+||+-+-+-+-+-+-+-+-+|                 ||
+|||i|j|k|l|m|n|o|p||                 ||
+||+-+-+-+-+-+-+-+-+|                 ||
+|+-----------------+-----------------+|
+||    +-+---+-+-+-+|  +-+---+-+-+-+  ||
+||    |a|bcd|e|f|i||  |a|bcd|e|f|i|  ||
+||    +-+-+-+-+g+-+|  +-+-+-+-+g+-+  ||
+||    |j|m|nop|h|q||  |j|m|nop|h|q|  ||
+||    |k+-+-+-+-+r||  |k+-+-+-+-+r|  ||
+||    |l|t|w|xyz|s||  |l|t|w|xyz|s|  ||
+||    +-+u+-+-+-+-+|  +-+u+-+-+-+-+  ||
+||    |A|v|B|E|FGH||  |A|v|B|E|FGH|  ||
+||    +-+-+C+-+-+-+|  +-+-+C+-+-+-+  ||
+||    |IJK|D|L|O|P||  |IJK|D|L|O|P|  ||
+||    +-+-+-+M+-+-+|  +-+-+-+M+-+-+  ||
+||    |Q|RST|N|U|V||  |Q|RST|N|U|V|  ||
+||    +-+---+-+-+-+|  +-+---+-+-+-+  ||
+|+-----------------+-----------------+|
+||  +-+---+-+-+-+  |+-+---+-+-+-+    ||
+||  |a|bcd|e|f|i|  ||a|bcd|e|f|i|    ||
+||  +-+-+-+-+g+-+  |+-+-+-+-+g+-+    ||
+||  |j|m|nop|h|q|  ||j|m|nop|h|q|    ||
+||  |k+-+-+-+-+r|  ||k+-+-+-+-+r|    ||
+||  |l|t|w|xyz|s|  ||l|t|w|xyz|s|    ||
+||  +-+u+-+-+-+-+  |+-+u+-+-+-+-+    ||
+||  |A|v|B|E|FGH|  ||A|v|B|E|FGH|    ||
+||  +-+-+C+-+-+-+  |+-+-+C+-+-+-+    ||
+||  |IJK|D|L|O|P|  ||IJK|D|L|O|P|    ||
+||  +-+-+-+M+-+-+  |+-+-+-+M+-+-+    ||
+||  |Q|RST|N|U|V|  ||Q|RST|N|U|V|    ||
+||  +-+---+-+-+-+  |+-+---+-+-+-+    ||
+|+-----------------+-----------------+|
+||+-+---+-+-+-+    |+-+-+-+-+-+-+-+-+||
+|||a|bcd|e|f|i|    ||a|b|c|d|e|f|g|h|||
+||+-+-+-+-+g+-+    |+-+-+-+-+-+-+-+-+||
+|||j|m|nop|h|q|    ||i|jkl|m|nop|q|t|||
+|||k+-+-+-+-+r|    |+-+-+-+-+-+-+r+-+||
+|||l|t|w|xyz|s|    ||u|v|wxy|z|A|s|D|||
+||+-+u+-+-+-+-+    |+-+-+-+-+-+B+-+-+||
+|||A|v|B|E|FGH|    ||E|F|I|JKL|C|M|P|||
+||+-+-+C+-+-+-+    |+-+G+-+---+-+N+-+||
+|||IJK|D|L|O|P|    ||Q|H|R|UVW|X|O|Y|||
+||+-+-+-+M+-+-+    |+-+-+S+-+-+-+-+-+||
+|||Q|RST|N|U|V|    ||Z|0|T|3|456|7|8|||
+||+-+---+-+-+-+    |+-+1+-+-+-+-+-+-+||
+||                 ||9|2|abc|d|efg|h|||
+||                 |+-+-+-+-+-+-+-+-+||
+||                 ||i|j|k|l|m|n|o|p|||
+||                 |+-+-+-+-+-+-+-+-+||
+|+-----------------+-----------------+|
++-------------------------------------+
+])
+AT_CLEANUP
 \f
 AT_BANNER([output rendering -- horizontal page breaks])
 
@@ -447,6 +763,15 @@ AT_CHECK([render-test input], [0], [dnl
 |1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|
 +-+-+-+-+-+-+-+-+-+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
 
++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|
++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+])
+AT_CHECK([render-test input -o mb0 --min-break=0], [0], [dnl
++-+-+-+-+-+-+-+-+-+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|
++-+-+-+-+-+-+-+-+-+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+
 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
 |30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|
 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
@@ -473,6 +798,19 @@ AT_CHECK([render-test input], [0], [dnl
 |ha|hb|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|hc|hd|
 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
 
++--+--+--+--+--+--+--+
+|ha|hb|48|49|50|hc|hd|
++--+--+--+--+--+--+--+
+])
+AT_CHECK([render-test -o mb0 --min-break=0 input], [0], [dnl
++--+--+-+-+-+-+-+-+-+-+-+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+|ha|hb|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|hc|hd|
++--+--+-+-+-+-+-+-+-+-+-+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+
++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+|ha|hb|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|hc|hd|
++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+
 +--+--+--+--+--+--+--+
 |ha|hb|48|49|50|hc|hd|
 +--+--+--+--+--+--+--+
@@ -506,6 +844,27 @@ AT_CHECK([render-test input], [0], [dnl
 |  46|  47|  48|  49|  50|
 +----+----+----+----+----+
 ])
+AT_CHECK([render-test -o mb0 --min-break=0 input], [0], [dnl
++----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+---
+|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cel
+|   1|   2|   3|   4|   5|   6|   7|   8|   9|  10|  11|  12|  13|  14|  15|  1
++----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+---
+
+-+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+--
+l|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|ce
+6|  17|  18|  19|  20|  21|  22|  23|  24|  25|  26|  27|  28|  29|  30|  31|
+-+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+--
+
+--+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+-
+ll|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|c
+32|  33|  34|  35|  36|  37|  38|  39|  40|  41|  42|  43|  44|  45|  46|  47|
+--+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+-
+
+---+----+----+
+ell|cell|cell|
+ 48|  49|  50|
+---+----+----+
+])
 AT_CLEANUP
 
 AT_SETUP([breaking row of many medium-size cells, with headers])
@@ -543,6 +902,27 @@ header1|cell|cell|header2
        |  49|  50|
        +----+----+
 ])
+AT_CHECK([render-test -o mb0 --min-break=0 input], [0], [dnl
+       +----+----+----+----+----+----+----+----+----+----+----+----+--+
+header1|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|ce|header2
+       |   1|   2|   3|   4|   5|   6|   7|   8|   9|  10|  11|  12|  |
+       +----+----+----+----+----+----+----+----+----+----+----+----+--+
+
+       +--+----+----+----+----+----+----+----+----+----+----+----+----+
+header1|ll|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|header2
+       |13|  14|  15|  16|  17|  18|  19|  20|  21|  22|  23|  24|  25|
+       +--+----+----+----+----+----+----+----+----+----+----+----+----+
+
+       +----+----+----+----+----+----+----+----+----+----+----+----+--+
+header1|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|ce|header2
+       |  26|  27|  28|  29|  30|  31|  32|  33|  34|  35|  36|  37|  |
+       +----+----+----+----+----+----+----+----+----+----+----+----+--+
+
+       +--+----+----+----+----+----+----+----+----+----+----+----+----+
+header1|ll|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|cell|header2
+       |38|  39|  40|  41|  42|  43|  44|  45|  46|  47|  48|  49|  50|
+       +--+----+----+----+----+----+----+----+----+----+----+----+----+
+])
 AT_CLEANUP
 
 AT_SETUP([breaking row of many big narrow cells])
@@ -602,6 +982,57 @@ AT_CHECK([render-test input], [0], [dnl
 |of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|
 +------+------+------+------+------+------+
 ])
+AT_CHECK([render-test -o mb0 --min-break=0 input], [0], [dnl
++------+------+------+------+------+------+------+------+------+------+------+-
+|  This|  This|  This|  This|  This|  This|  This|  This|  This|  This|  This|
+|    is|    is|    is|    is|    is|    is|    is|    is|    is|    is|    is|
+|cell 1|cell 2|cell 3|cell 4|cell 5|cell 6|cell 7|cell 8|cell 9|  cell|  cell|
+|  in a|  in a|  in a|  in a|  in a|  in a|  in a|  in a|  in a| 10 in| 11 in|
+|series|series|series|series|series|series|series|series|series|     a|     a|
+|of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|series|series|s
+|      |      |      |      |      |      |      |      |      |of 50.|of 50.|o
++------+------+------+------+------+------+------+------+------+------+------+-
+
+-----+------+------+------+------+------+------+------+------+------+------+---
+ This|  This|  This|  This|  This|  This|  This|  This|  This|  This|  This|  T
+   is|    is|    is|    is|    is|    is|    is|    is|    is|    is|    is|
+ cell|  cell|  cell|  cell|  cell|  cell|  cell|  cell|  cell|  cell|  cell|  c
+12 in| 13 in| 14 in| 15 in| 16 in| 17 in| 18 in| 19 in| 20 in| 21 in| 22 in| 23
+    a|     a|     a|     a|     a|     a|     a|     a|     a|     a|     a|
+eries|series|series|series|series|series|series|series|series|series|series|ser
+f 50.|of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|of
+-----+------+------+------+------+------+------+------+------+------+------+---
+
+---+------+------+------+------+------+------+------+------+------+------+-----
+his|  This|  This|  This|  This|  This|  This|  This|  This|  This|  This|  Thi
+ is|    is|    is|    is|    is|    is|    is|    is|    is|    is|    is|    i
+ell|  cell|  cell|  cell|  cell|  cell|  cell|  cell|  cell|  cell|  cell|  cel
+ in| 24 in| 25 in| 26 in| 27 in| 28 in| 29 in| 30 in| 31 in| 32 in| 33 in| 34 i
+  a|     a|     a|     a|     a|     a|     a|     a|     a|     a|     a|
+ies|series|series|series|series|series|series|series|series|series|series|serie
+50.|of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|of 50
+---+------+------+------+------+------+------+------+------+------+------+-----
+
+-+------+------+------+------+------+------+------+------+------+------+------+
+s|  This|  This|  This|  This|  This|  This|  This|  This|  This|  This|  This|
+s|    is|    is|    is|    is|    is|    is|    is|    is|    is|    is|    is|
+l|  cell|  cell|  cell|  cell|  cell|  cell|  cell|  cell|  cell|  cell|  cell|
+n| 35 in| 36 in| 37 in| 38 in| 39 in| 40 in| 41 in| 42 in| 43 in| 44 in| 45 in|
+a|     a|     a|     a|     a|     a|     a|     a|     a|     a|     a|     a|
+s|series|series|series|series|series|series|series|series|series|series|series|
+.|of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|of 50.|
+-+------+------+------+------+------+------+------+------+------+------+------+
+
++------+------+------+------+------+
+|  This|  This|  This|  This|  This|
+|    is|    is|    is|    is|    is|
+|  cell|  cell|  cell|  cell|  cell|
+| 46 in| 47 in| 48 in| 49 in| 50 in|
+|     a|     a|     a|     a|     a|
+|series|series|series|series|series|
+|of 50.|of 50.|of 50.|of 50.|of 50.|
++------+------+------+------+------+
+])
 AT_CLEANUP
 
 AT_SETUP([breaking 2 rows of many small cells])
@@ -617,6 +1048,19 @@ AT_CHECK([render-test input], [0], [dnl
 |51|52|53|54|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|
 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
 
++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---+
+|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49| 50|
++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---+
+|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99|100|
++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---+
+])
+AT_CHECK([render-test -o mb0 --min-break=0 input], [0], [dnl
++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|
++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+|51|52|53|54|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|
++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+
 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---+
 |27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49| 50|
 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---+
@@ -650,12 +1094,27 @@ AT_CHECK([render-test input], [0], [dnl
 45| 46| 47| 48| 49|50|
 --+---+---+---+---+--+
 ])
+AT_CHECK([render-test -o mb0 --min-break=0 input], [0], [dnl
+ a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M
++-+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+|1|  2|  3|  4|  5|  6|  7|  8|  9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20|
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+| 26| 27| 28| 29| 30| 31| 32| 33| 34| 35| 36| 37| 38| 39| 40| 41| 42| 43| 44| 4
++---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+--
+
+ N O P Q R S T U V  W
++---+---+---+---+----+
+| 21| 22| 23| 24|  25|
++-+-+-+-+-+-+-+-+-+--+
+45| 46| 47| 48| 49|50|
+--+---+---+---+---+--+
+])
 AT_CLEANUP
 
 AT_SETUP([horz break 6x6, joined rows and columns])
 AT_KEYWORDS([render rendering])
-RENDER_WEAVE_6X6
-AT_CHECK([render-test --width=6 input], [0], [dnl
+AT_DATA([input], [WEAVE_6X6])
+AT_DATA([expout], [dnl
 +-+--
 |a|bc
 +-+-+
@@ -698,12 +1157,14 @@ yz|s|
 |U|V|
 +-+-+
 ])
+AT_CHECK([render-test --width=6 input], [0], [expout])
+AT_CHECK([render-test -o mb0 --min-break=0 --width=6 input], [0], [expout])
 AT_CLEANUP
 
 AT_SETUP([horz break 6x6, joined rows and columns, left header])
 AT_KEYWORDS([render rendering])
-RENDER_WEAVE_6X6([1 0 0 0])
-AT_CHECK([render-test --width=10 input], [0], [dnl
+AT_DATA([input], [WEAVE_6X6([1 0 0 0])])
+AT_DATA([expout], [dnl
 +-+---+-+
 |a|bcd|e|
 +-+-+-+-+
@@ -713,7 +1174,7 @@ AT_CHECK([render-test --width=10 input], [0], [dnl
 +-+u+-+-+
 |A|v|B|E|
 +-+-+C+-+
-|K|D|L|
+|IJK|D|L|
 +-+-+-+M|
 |Q|RST|N|
 +-+---+-+
@@ -732,12 +1193,14 @@ AT_CHECK([render-test --width=10 input], [0], [dnl
 |Q|U|V|
 +-+-+-+
 ])
+AT_CHECK([render-test --width=10 input], [0], [expout])
+AT_CHECK([render-test -o mb0 --min-break=0 --width=10 input], [0], [expout])
 AT_CLEANUP
 
 AT_SETUP([horz break 6x6, joined rows and columns, right header])
 AT_KEYWORDS([render rendering])
-RENDER_WEAVE_6X6([0 1 0 0])
-AT_CHECK([render-test --width=10 input], [0], [dnl
+AT_DATA([input], [WEAVE_6X6([0 1 0 0])])
+AT_DATA([expout], [dnl
 +-+---+-+
 |a|bcd|i|
 +-+-+-+-+
@@ -759,13 +1222,15 @@ op|h|q|
 +-+-+r|
 |xyz|s|
 +-+-+-+
-|E|F H|
+|E|FGH|
 +-+-+-+
 |L|O|P|
 |M+-+-+
 |N|U|V|
 +-+-+-+
 ])
+AT_CHECK([render-test --width=10 input], [0], [expout])
+AT_CHECK([render-test -o mb0 --min-break=0 --width=10 input], [0], [expout])
 AT_CLEANUP
 
 AT_SETUP([breaking joined cells too wide for page])
@@ -797,6 +1262,31 @@ AT_CHECK([render-test --width=10 input], [0], [dnl
 |H|I|J|K|
 +-+-+-+-+
 
+----+
+ ghi|
+ jkl|
+----+
+ stu|
+ vwx|
++---+
+|EFG|
++-+-+
+|L|M|
++-+-+
+])
+AT_CHECK([render-test -o mb0 --min-break=0 --width=10 input], [0], [dnl
++--------
+|abc def
+|
++-----+--
+|  mno|
+|  pqr|
++---+-+-+
+|yzA|BCD|
++-+-+-+-+
+|H|I|J|K|
++-+-+-+-+
+
 ----+
  ghi|
  jkl|
@@ -852,6 +1342,43 @@ qr|
 |J|K|
 +-+-+
 
+----+
+ ghi|
+ jkl|
+----+
+ stu|
+ vwx|
++---+
+|EFG|
++-+-+
+|L|M|
++-+-+
+])
+AT_CHECK([render-test -o mb0 --min-break=0 --width=6 input], [0], [dnl
++----
+|abc
+|
++----
+|  mn
+|  pq
++---+
+|yzA|
++-+-+
+|H|I|
++-+-+
+
+-----
+ def
+
+--+--
+no|
+qr|
++-+-+
+|BCD|
++-+-+
+|J|K|
++-+-+
+
 ----+
  ghi|
  jkl|
@@ -881,6 +1408,17 @@ mnopqr
 
 stuvwx
 
+yz
+])
+AT_CHECK([render-test -o mb0 --min-break=0 --width=6 input], [0], [dnl
+abcdef
+
+ghijkl
+
+mnopqr
+
+stuvwx
+
 yz
 ])
 AT_CLEANUP
@@ -891,17 +1429,13 @@ AT_CAPTURE_FILE([input])
 AT_DATA([input], [1 1
 @abcdefghijklmnopqrstuvwxyz
 ])
-AT_CHECK([render-test --width=6 input], [0], [dnl
+AT_DATA([expout], [dnl
 +-----
 |abcde
 +-----
 
 ------
-defghi
-------
-
-------
-hijklm
+fghijk
 ------
 
 ------
@@ -909,22 +1443,20 @@ lmnopq
 ------
 
 ------
-pqrstu
-------
-
-------
-tuvwxy
+rstuvw
 ------
 
 ---+
 xyz|
 ---+
 ])
+AT_CHECK([render-test --width=6 input], [0], [expout])
+AT_CHECK([render-test -o mb0 --min-break=0 --width=6 input], [0], [expout])
 AT_CLEANUP
 
 AT_SETUP([horz break 8x8 with many 2x2 joins])
 AT_KEYWORDS([render rendering])
-RENDER_8X8_2
+AT_DATA([input], [WEAVE_8X8_2])
 AT_CHECK([render-test --width=8 input], [0],[dnl
 +---+--
 |abc|jk
@@ -997,45 +1529,167 @@ KL|  |
 |    |
 +----+
 ])
-AT_CLEANUP
-\f
-AT_BANNER([output rendering -- vertical page breaks])
-
-AT_SETUP([breaking column of many small cells])
-AT_KEYWORDS([render rendering])
-AT_CAPTURE_FILE([input])
-AT_DATA([input], [20 1
-m4_for([x], [1], [20], [1], [@x
-])])
-AT_CHECK([render-test --length=10 input], [0], [dnl
-+--+
-| 1|
-+--+
-| 2|
-+--+
-| 3|
-+--+
-| 4|
-+--+
-
-+--+
-| 5|
-+--+
-| 6|
-+--+
-| 7|
-+--+
-| 8|
-+--+
+AT_CHECK([render-test -o mb0 --min-break=0 --width=8 input], [0],[dnl
++---+--
+|abc|jk
+|def|  
+|ghi+--
+|   |yz
++-+-+BC
+|Q|V|EF
+|R| |  
+|S+-+-+
+|T|012|
+|U|345|
+| |678|
+| |   |
++-+-+-+
+|xyz|G|
+|ABC|H|
+|DEF|I|
+|   | |
++---+-+
+|abcde|
+|     |
++-----+
 
-+--+
-| 9|
-+--+
-|10|
-+--+
-|11|
-+--+
-|12|
+--+----+
+kl| mno|
+  | pqr|
+--+ stu|
+zA|    |
+CD+-+--+
+FG|W| Z|
+  |X|  |
++-+Y+--+
+|9| | ab
+| | | de
++-+-+ gh
+|opq|   
+|rst+---
+|uvw| JK
+|   |   
++---+--+
+| MNOPQ|
+| RSTUV|
+| WXYZ0|
+|      |
++------+
+
++----+
+| vwx|
+|    |
++----+
+| HIJ|
+| KLM|
+| NOP|
+|    |
++-+--+
+bc| j|
+ef| k|
+hi| l|
+  | m|
+--+ n|
+KL|  |
+  |  |
++-+--+
+| 123|
+| 456|
+| 789|
+
+|    |
++----+
+])
+AT_CLEANUP
+\f
+AT_BANNER([output rendering -- vertical page breaks])
+
+AT_SETUP([breaking column of many small cells])
+AT_KEYWORDS([render rendering])
+AT_CAPTURE_FILE([input])
+AT_DATA([input], [20 1
+m4_for([x], [1], [20], [1], [@x
+])])
+AT_CHECK([render-test --length=10 input], [0], [dnl
++--+
+| 1|
++--+
+| 2|
++--+
+| 3|
++--+
+| 4|
++--+
+
++--+
+| 5|
++--+
+| 6|
++--+
+| 7|
++--+
+| 8|
++--+
+
++--+
+| 9|
++--+
+|10|
++--+
+|11|
++--+
+|12|
++--+
+
++--+
+|13|
++--+
+|14|
++--+
+|15|
++--+
+|16|
++--+
+
++--+
+|17|
++--+
+|18|
++--+
+|19|
++--+
+|20|
++--+
+])
+AT_CHECK([render-test -o mb0 --min-break=0 --length=10 input], [0], [dnl
++--+
+| 1|
++--+
+| 2|
++--+
+| 3|
++--+
+| 4|
++--+
+
++--+
+| 5|
++--+
+| 6|
++--+
+| 7|
++--+
+| 8|
++--+
+
++--+
+| 9|
++--+
+|10|
++--+
+|11|
++--+
+|12|
 +--+
 
 +--+
@@ -1111,6 +1765,61 @@ AT_CHECK([render-test --length=13 input], [0], [dnl
 | b|
 +--+
 
++--+
+| a|
++--+
+|13|
++--+
+|14|
++--+
+|15|
++--+
+| b|
++--+
+])
+AT_CHECK([render-test -o mb0 --min-break=0 --length=13 input], [0], [dnl
++--+
+| a|
++--+
+| 1|
++--+
+| 2|
++--+
+| 3|
++--+
+| 4|
++--+
+| b|
++--+
+
++--+
+| a|
++--+
+| 5|
++--+
+| 6|
++--+
+| 7|
++--+
+| 8|
++--+
+| b|
++--+
+
++--+
+| a|
++--+
+| 9|
++--+
+|10|
++--+
+|11|
++--+
+|12|
++--+
+| b|
++--+
+
 +--+
 | a|
 +--+
@@ -1133,7 +1842,7 @@ AT_DATA([input], [17 1 0 0 1 1
 m4_for([x], [1], [15], [1], [@x
 ])@b
 ])
-AT_CHECK([render-test --length=10 input], [0], [dnl
+AT_DATA([expout], [dnl
 +--+
 | a|
 +--+
@@ -1178,6 +1887,8 @@ AT_CHECK([render-test --length=10 input], [0], [dnl
 | b|
 +--+
 ])
+AT_CHECK([render-test --length=10 input], [0], [expout])
+AT_CHECK([render-test -o mb0 --min-break=0 --length=10 input], [0], [expout])
 AT_CLEANUP
 
 AT_SETUP([breaking column of many medium-size cells])
@@ -1280,6 +1991,99 @@ AT_CHECK([render-test --length 10 input], [0], [dnl
 +---------+
 |   top 19|
 |  cell 19|
+|bottom 19|
++---------+
+|   top 20|
+|  cell 20|
+|bottom 20|
++---------+
+])
+AT_CHECK([render-test -o mb0 --min-break=0 --length 10 input], [0], [dnl
++---------+
+|    top 1|
+|   cell 1|
+| bottom 1|
++---------+
+|    top 2|
+|   cell 2|
+| bottom 2|
++---------+
+|    top 3|
+
+|   cell 3|
+| bottom 3|
++---------+
+|    top 4|
+|   cell 4|
+| bottom 4|
++---------+
+|    top 5|
+|   cell 5|
+
+| bottom 5|
++---------+
+|    top 6|
+|   cell 6|
+| bottom 6|
++---------+
+|    top 7|
+|   cell 7|
+| bottom 7|
++---------+
+
++---------+
+|    top 8|
+|   cell 8|
+| bottom 8|
++---------+
+|    top 9|
+|   cell 9|
+| bottom 9|
++---------+
+|   top 10|
+
+|  cell 10|
+|bottom 10|
++---------+
+|   top 11|
+|  cell 11|
+|bottom 11|
++---------+
+|   top 12|
+|  cell 12|
+
+|bottom 12|
++---------+
+|   top 13|
+|  cell 13|
+|bottom 13|
++---------+
+|   top 14|
+|  cell 14|
+|bottom 14|
++---------+
+
++---------+
+|   top 15|
+|  cell 15|
+|bottom 15|
++---------+
+|   top 16|
+|  cell 16|
+|bottom 16|
++---------+
+|   top 17|
+
+|  cell 17|
+|bottom 17|
++---------+
+|   top 18|
+|  cell 18|
+|bottom 18|
++---------+
+|   top 19|
+|  cell 19|
+
 |bottom 19|
 +---------+
 |   top 20|
@@ -1292,13 +2096,52 @@ AT_CLEANUP
 AT_SETUP([breaking 3 columns with many joined cells])
 AT_KEYWORDS([render rendering])
 AT_CAPTURE_FILE([input])
+#  +--+--+
+# a| 1|11|
+#  +--+ab|
+# b| 2|cd|
+#  |ab+--+
+# c|cd|12|
+#  +--+ab|
+# d| 3|cd|
+#  |ab+--+
+# e|cd|13|
+#  +--+ab|
+# f| 4|cd|
+#  |ab+--+
+# g|cd|14|
+#  +--+ab|
+# h| 5|cd|
+#  |ab+--+
+# i|cd|15|
+#  +--+ab|
+# j| 6|cd|
+#  |ab+--+
+# k|cd|16|
+#  +--+ab|
+# l| 7|cd|
+#  |ab+--+
+# m|cd|17|
+#  +--+ab|
+# n| 8|cd|
+#  |ab+--+
+# o|cd|18|
+#  +--+ab|
+# p| 9|cd|
+#  |ab+--+
+# q|cd|19|
+#  +--+ab|
+# r|10|cd|
+#  |ab+--+
+# s|cd|20|
+#  +--+--+
 AT_DATA([input], [3 19
 m4_foreach([x], [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s], [x
 ])@1
 m4_for([x], [2], [19], [1], [1*2 @x\nab\ncd
 ])@20
 ])
-AT_CHECK([render-test --length=6 --transpose input], [0], [dnl
+AT_DATA([expout], [dnl
  +--+--+
 a| 1|11|
  +--+ab|
@@ -1357,11 +2200,14 @@ r|10|cd|
 s|cd|20|
  +--+--+
 ])
+AT_CHECK([render-test --length=6 --transpose input], [0], [expout])
+AT_CHECK([render-test -o mb0 --min-break=0 --length=6 --transpose input],
+  [0], [expout])
 AT_CLEANUP
 
 AT_SETUP([vert break 6x6, joined rows and columns])
 AT_KEYWORDS([render rendering])
-RENDER_WEAVE_6X6
+AT_DATA([input], [WEAVE_6X6])
 AT_CHECK([render-test --length=6 input], [0], [dnl
 +-+---+-+-+-+
 |a|bcd|e|f|i|
@@ -1375,6 +2221,25 @@ AT_CHECK([render-test --length=6 input], [0], [dnl
 |A|v|B|E|FGH|
 +-+-+C+-+---+
 
++---+C+-+-+-+
+|IJK|D|L|O|P|
++-+-+-+M+-+-+
+|Q|RST|N|U|V|
++-+---+-+-+-+
+])
+AT_CHECK([render-test -o mb0 --min-break=0 --length=6 input], [0], [dnl
++-+---+-+-+-+
+|a|bcd|e|f|i|
++-+-+-+-+g+-+
+|j|m|nop|h|q|
+|k+-+---+-+r|
+
+|k+-+-+---+r|
+|l|t|w|xyz|s|
++-+u+-+-+-+-+
+|A|v|B|E|FGH|
++-+-+C+-+---+
+
 +---+C+-+-+-+
 |IJK|D|L|O|P|
 +-+-+-+M+-+-+
@@ -1412,6 +2277,25 @@ AT_CHECK([render-test --transpose --length=6 input], [0], [dnl
 |stu|XYZ|qrs|F|
 |vwx|012+---+-+
 
+|vwx|012+---+-+
+|yzA|345|tuv|G|
+|BCD|678|wxy+-+
+|EFG|90a|zAB|H|
++---+---+---+-+
+])
+AT_CHECK([render-test -o mb0 --min-break=0 --transpose --length=6 input], [0], [dnl
++---+---+---+-+
+|abc|HIJ|bcd|C|
+|def|KLM|efg+-+
+|ghi|OPQ|hij|D|
+|jkl|RST+---+-+
+
+|jkl|RST+---+-+
+|mno|UVW|klm|E|
+|pqr+---+nop+-+
+|stu|XYZ|qrs|F|
+|vwx|012+---+-+
+
 |vwx|012+---+-+
 |yzA|345|tuv|G|
 |BCD|678|wxy+-+
@@ -1420,13 +2304,30 @@ AT_CHECK([render-test --transpose --length=6 input], [0], [dnl
 ])
 AT_CLEANUP
 
-AT_SETUP([breaking cell too tall for page, no border])
-AT_KEYWORDS([render rendering])
-AT_CAPTURE_FILE([input])
-AT_DATA([input], [1 1
-abc defg hij klmn opq rstu vwx yz ABCDE FGH I JK LMNOP QR STU VWXYZ
+AT_SETUP([breaking cell too tall for page, no border])
+AT_KEYWORDS([render rendering])
+AT_CAPTURE_FILE([input])
+AT_DATA([input], [1 1
+abc defg hij klmn opq rstu vwx yz ABCDE FGH I JK LMNOP QR STU VWXYZ
+])
+AT_CHECK([render-test --width=6 --length=6 input], [0], [dnl
+   abc
+  defg
+   hij
+  klmn
+   opq
+  rstu
+
+vwx yz
+ ABCDE
+ FGH I
+    JK
+ LMNOP
+QR STU
+
+ VWXYZ
 ])
-AT_CHECK([render-test --width=6 --length=6 input], [0], [dnl
+AT_CHECK([render-test -o mb0 --min-break=0 --width=6 --length=6 input], [0], [dnl
    abc
   defg
    hij
@@ -1451,7 +2352,7 @@ AT_CAPTURE_FILE([input])
 AT_DATA([input], [1 1
 @abc defg hij klmn opq rstu vwx yz ABCDE FGH I JK LMNOP QR STU VWXYZ
 ])
-AT_CHECK([render-test --width=7 --length=6 input], [0], [dnl
+AT_DATA([expout], [dnl
 +-----+
 |  abc|
 | defg|
@@ -1459,19 +2360,12 @@ AT_CHECK([render-test --width=7 --length=6 input], [0], [dnl
 | klmn|
 |  opq|
 
-| klmn|
-|  opq|
 | rstu|
 |  vwx|
-|   yz|
-|ABCDE|
-
 |   yz|
 |ABCDE|
 |FGH I|
 |   JK|
-|LMNOP|
-|   QR|
 
 |LMNOP|
 |   QR|
@@ -1479,13 +2373,48 @@ AT_CHECK([render-test --width=7 --length=6 input], [0], [dnl
 |VWXYZ|
 +-----+
 ])
+AT_CHECK([render-test --width=7 --length=6 input], [0], [expout])
+AT_CHECK([render-test -o mb0 --min-break=0 --width=7 --length=6 input],
+  [0], [expout])
+AT_CLEANUP
+
+AT_SETUP([breaking nested cell too tall for page])
+AT_KEYWORDS([render rendering])
+AT_CAPTURE_FILE([input])
+AT_DATA([input], [WEAVE_8X8[]WEAVE_6X6[]dnl
+1 2
+@{0}
+@{1}
+])
+AT_CHECK([render-test input --length=10], [0], [dnl
++-----------------+-------------+
+|+-+-+-+-+-+-+-+-+|+-+---+-+-+-+|
+||a|b|c|d|e|f|g|h|||a|bcd|e|f|i||
+|+-+-+-+-+-+-+-+-+|+-+-+-+-+g+-+|
+||i|jkl|m|nop|q|t|||j|m|nop|h|q||
+|+-+-+-+-+-+-+r+-+||k+-+-+-+-+r||
+||u|v|wxy|z|A|s|D|||l|t|w|xyz|s||
+|+-+-+-+-+-+B+-+-+|+-+u+-+-+-+-+|
+||E|F|I|JKL|C|M|P|||A|v|B|E|FGH||
+|+-+G+-+---+-+N+-+|+-+-+C+-+-+-+|
+
+||Q|H|R|UVW|X|O|Y|||IJK|D|L|O|P||
+|+-+-+S+-+-+-+-+-+|+-+-+-+M+-+-+|
+||Z|0|T|3|456|7|8|||Q|RST|N|U|V||
+|+-+1+-+-+-+-+-+-+|+-+---+-+-+-+|
+||9|2|abc|d|efg|h||             |
+|+-+-+-+-+-+-+-+-+|             |
+||i|j|k|l|m|n|o|p||             |
+|+-+-+-+-+-+-+-+-+|             |
++-----------------+-------------+
+])
 AT_CLEANUP
 \f
 AT_BANNER([output rendering -- double page breaks])
 
 AT_SETUP([double break 6x6, joined rows and columns])
 AT_KEYWORDS([render rendering])
-RENDER_WEAVE_6X6
+AT_DATA([input], [WEAVE_6X6])
 AT_CHECK([render-test --width=6 --length=6 input], [0], [dnl
 +-+--
 |a|bc
@@ -1535,6 +2464,61 @@ yz|s|
 |FGH|
 +---+
 
++-+-+
+|O|P|
++-+-+
+|U|V|
++-+-+
+])
+AT_CHECK([render-test -o mb0 --min-break=0 --width=6 --length=6 input], [0], [dnl
++-+--
+|a|bc
++-+-+
+|j|m|
+|k+-+
+
+|k+-+
+|l|t|
++-+u|
+|A|v|
++-+-+
+
++---+
+|IJK|
++-+-+
+|Q|RS
++-+--
+
+--+-+
+cd|e|
++-+-+
+|nop|
++---+
+
++-+--
+|w|xy
++-+-+
+|B|E|
+|C+-+
+
+|C+-+
+|D|L|
++-+M|
+ST|N|
+--+-+
+
++-+-+
+|f|i|
+|g+-+
+|h|q|
++-+r|
+
+--+r|
+yz|s|
++-+-+
+|FGH|
++---+
+
 +-+-+
 |O|P|
 +-+-+
@@ -1545,7 +2529,7 @@ AT_CLEANUP
 
 AT_SETUP([double break 8x8, with joins, left and right headers])
 AT_KEYWORDS([render rendering])
-RENDER_8X8([1 1 0 0])
+AT_DATA([input], [WEAVE_8X8([1 1 0 0])])
 AT_CHECK([render-test input --width=14 --length=14], [0], [dnl
 +-+-+-+-+-+-+
 |a|b|c|d|e|h|
@@ -1575,6 +2559,47 @@ AT_CHECK([render-test input --width=14 --length=14], [0], [dnl
 |u| A|s|D|
 +-+ B+-+-+
 
++-+ B+-+-+
+|E| C|M|P|
++-+--+N+-+
+|Q| X|O|Y|
++-+--+-+-+
+|Z|56|7|8|
++-+--+-+-+
+|9| efg|h|
++-+--+-+-+
+|i| n|o|p|
++-+--+-+-+
+])
+AT_CHECK([render-test -o mb0 --min-break=0 input --width=14 --length=14], [0], [dnl
++-+-+-+-+-+-+
+|a|b|c|d|e|h|
++-+-+-+-+-+-+
+|i|jkl|m|n|t|
++-+-+-+-+-+-+
+|u|v|wxy|z|D|
++-+-+-+-+-+-+
+|E|F|I|JKL|P|
++-+G+-+---+-+
+|Q|H|R|UVW|Y|
++-+-+S+-+-+-+
+|Z|0|T|3|4|8|
++-+1+-+-+-+-+
+
++-+1+---+-+-+
+|9|2|abc|d|h|
++-+-+-+-+-+-+
+|i|j|k|l|m|p|
++-+-+-+-+-+-+
+
++-+--+-+-+
+|a| f|g|h|
++-+--+-+-+
+|i|op|q|t|
++-+--+r+-+
+|u| A|s|D|
++-+ B+-+-+
+
 +-+ B+-+-+
 |E| C|M|P|
 +-+--+N+-+
@@ -1591,7 +2616,7 @@ AT_CLEANUP
 
 AT_SETUP([double break 8x8, with joins, top and bottom headers])
 AT_KEYWORDS([render rendering])
-RENDER_8X8([0 0 1 1])
+AT_DATA([input], [WEAVE_8X8([0 0 1 1])])
 AT_CHECK([render-test input --width=14 --length=14], [0], [dnl
 +-+-+-+-+-+-+
 |a|b|c|d|e|f|
@@ -1632,6 +2657,57 @@ AT_CHECK([render-test input --width=14 --length=14], [0], [dnl
 |o|p|
 +-+-+
 
++-+-+
+|g|h|
++-+-+
+|7|8|
+| | |
++-+-+
+fg|h|
++-+-+
+|o|p|
++-+-+
+])
+AT_CHECK([render-test -o mb0 --min-break=0 input --width=14 --length=14], [0], [dnl
++-+-+-+-+-+-+
+|a|b|c|d|e|f|
++-+-+-+-+-+-+
+|i|jkl|m|nop|
++-+-+-+-+-+-+
+|u|v|wxy|z|A|
++-+-+-+-+-+B|
+|E|F|I|JKL|C|
++-+G+-+---+-+
+|Q|H|R|UVW|X|
++-+-+-+-+-+-+
+|i|j|k|l|m|n|
++-+-+-+-+-+-+
+
++-+-+-+-+-+-+
+|a|b|c|d|e|f|
++-+-+-+-+-+-+
+|Z|0|S|3|456|
+| |1|T| |   |
++-+2+-+-+-+-+
+|9| |abc|d|ef
++-+-+-+-+-+-+
+|i|j|k|l|m|n|
++-+-+-+-+-+-+
+
++-+-+
+|g|h|
++-+-+
+|q|t|
+|r+-+
+|s|D|
++-+-+
+|M|P|
+|N+-+
+|O|Y|
++-+-+
+|o|p|
++-+-+
+
 +-+-+
 |g|h|
 +-+-+
@@ -1647,7 +2723,7 @@ AT_CLEANUP
 
 AT_SETUP([double break 8x8, with joins, all headers])
 AT_KEYWORDS([render rendering])
-RENDER_8X8([1 1 1 1])
+AT_DATA([input], [WEAVE_8X8([1 1 1 1])])
 AT_CHECK([render-test input --width=14 --length=14], [0], [dnl
 +-+-+-+-+-+-+
 |a|b|c|d|e|h|
@@ -1688,6 +2764,57 @@ AT_CHECK([render-test input --width=14 --length=14], [0], [dnl
 |i| n|o|p|
 +-+--+-+-+
 
++-+--+-+-+
+|a| f|g|h|
++-+--+-+-+
+|Z|56|7|8|
+| |  | | |
++-+--+-+-+
+|9| efg|h|
++-+--+-+-+
+|i| n|o|p|
++-+--+-+-+
+])
+AT_CHECK([render-test -o mb0 --min-break=0 input --width=14 --length=14], [0], [dnl
++-+-+-+-+-+-+
+|a|b|c|d|e|h|
++-+-+-+-+-+-+
+|i|jkl|m|n|t|
++-+-+-+-+-+-+
+|u|v|wxy|z|D|
++-+-+-+-+-+-+
+|E|F|I|JKL|P|
++-+G+-+---+-+
+|Q|H|R|UVW|Y|
++-+-+-+-+-+-+
+|i|j|k|l|m|p|
++-+-+-+-+-+-+
+
++-+-+-+-+-+-+
+|a|b|c|d|e|h|
++-+-+-+-+-+-+
+|Z|0|S|3|4|8|
+| |1|T| | | |
++-+2+-+-+-+-+
+|9| |abc|d|h|
++-+-+-+-+-+-+
+|i|j|k|l|m|p|
++-+-+-+-+-+-+
+
++-+--+-+-+
+|a| f|g|h|
++-+--+-+-+
+|i|op|q|t|
++-+--+r+-+
+|u| A|s|D|
++-+ B+-+-+
+|E| C|M|P|
++-+--+N+-+
+|Q| X|O|Y|
++-+--+-+-+
+|i| n|o|p|
++-+--+-+-+
+
 +-+--+-+-+
 |a| f|g|h|
 +-+--+-+-+
@@ -1725,12 +2852,11 @@ AT_CHECK([render-test --width=15 --length=15 input], [0], [dnl
 +-+--+--+---+
 |h|       The
 | |        su
-| |    determ
-+-+       han
-|i|missing va
-| |     If IN
-| |         s
-+-+      user
++-+    determ
+|i|       han
+| |missing va
+| |If INCLUDE
++-+ then user
 |j|        va
 | |   include
 | | calculati
@@ -1739,14 +2865,14 @@ AT_CHECK([render-test --width=15 --length=15 input], [0], [dnl
 +-+ NOINCLUDE
 |k|      whic
 | |
-+-+      user
-|l|        va
-| |         e
+| |      user
++-+        va
+|l|         e
+| |
 | |
 +-+
 |m|
 | |
-| |
 +-+----------
 
 +--+--+--+
@@ -1757,8 +2883,7 @@ ubcommand|
 mines the|
 ndling of|
 ariables.|
-NCLUDE is|
-set, then|
+E is set,|
 r‑missing|
 alues are|
 ed in the|
@@ -1778,6 +2903,62 @@ excluded.|
          |
 ---------+
 ])
+AT_CHECK([render-test -o mb0 --min-break=0 --width=15 --length=15 input], [0], [dnl
++-+--+--+---+-
+|a| b| c|  d|
++-+--+--+---+-
+|h|       The
+| |        sub
++-+    determi
+|i|       hand
+| |missing var
+| |If INCLUDE
++-+ then user‑
+|j|        val
+| |   included
+| | calculatio
++-+ NOINCLUDE
+|k|      which
+
+| |          d
+| |      user‑
++-+        val
+|l|         ex
+| |
+| |
++-+
+|m|
+| |
++-+-----------
+
+-+--+--+
+e| f| g|
+-+--+--+
+MISSING|
+
+command|
+nes the|
+ling of|
+iables.|
+is set,|
+missing|
+ues are|
+ in the|
+ns.  If|
+is set,|
+ is the|
+efault,|
+missing|
+ues are|
+cluded.|
+
+       |
+       |
+       |
+       |
+       |
+-------+
+])
 AT_CLEANUP
 \f
 AT_BANNER([output rendering -- problematic procedures])
@@ -1796,12 +2977,6 @@ END DATA.
 LIST.
 ])
 AT_CHECK([pspp list.sps], [0], [dnl
-DATA LIST
-
-BEGIN DATA
-
-LIST
-
 Data List
 x y z
 -----
@@ -1810,3 +2985,61 @@ x y z
 7 8 9
 ])
 AT_CLEANUP
+
+# Long string variables tend to end in lots of spaces.  The ASCII
+# driver didn't handle this very well: it would essentially produce
+# one blank line in a cell for each trailing space.  This test
+# checks for regression.  See bug #38672.
+AT_SETUP([ASCII driver renders end of line spaces reasonably])
+AT_KEYWORDS([render rendering])
+AT_DATA([input], [dnl
+3 3
+@a
+@b
+@xyzzy                                          @&t@
+@d
+@e
+@f
+@g
+@h
+@i
+])
+AT_CHECK([render-test --width=15 --length=15 input], [0], [dnl
++-+-+-----+
+|a|b|xyzzy|
++-+-+-----+
+|d|e|    f|
++-+-+-----+
+|g|h|    i|
++-+-+-----+
+])
+AT_CLEANUP
+
+# There was a bug that, when multiple cells spanned a single column
+# (or row), only the dimensions of the cell nearest the bottom of the
+# table were actually considered.  This checks for regression.  (This
+# problem was most easily observed with SYSFILE INFO, which uses lots
+# of spanned cells).
+#
+# Without the fix, the output looks like this:
+# +-------+
+# | A long|
+# |   text|
+# |string.|
+# +-------+
+# |shorter|
+AT_SETUP([multiple spanned cells all contribute to dimensions])
+AT_KEYWORDS([render rendering])
+AT_DATA([input], [dnl
+2 2
+1*2 @A long text string.
+1*2 @shorter
+])
+AT_CHECK([render-test --width=30 --length=15 input], [0], [dnl
++-------------------+
+|A long text string.|
++-------------------+
+|            shorter|
++-------------------+
+])
+AT_CLEANUP