table-select: Only cut headers into two if needed in table_select_slice().
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 13 Jul 2014 17:41:13 +0000 (10:41 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 13 Jul 2014 17:41:13 +0000 (10:41 -0700)
commit1d0b435ea6ca932d3e1c446db402ec41b9024ccd
tree6b46abeb280661de5dfff14836dd7e29ee877f33
parent14877636310b84dc7d501c95e6e4feeb3186d6a9
table-select: Only cut headers into two if needed in table_select_slice().

Until now, when including headers in the table it returns,
table_select_slice() has always either returned the entire original table
or a set of chunks: left header, selected body, right header.  However, it
is possible to do better when the selected body includes all the cells
up to, say, the right header: then you only need a single chunk to include
the body and the right header.  Besides saving memory, this also has the
advantage that, if a joined cell crosses between the body and the header,
it is not cut into two pieces by chunking.  It doesn't make too much sense
to join a cell across body and header, but this still makes it easier to
render better if someone does that.

The testsuite includes a few tables that do join a cell across body and
header.  This commit improves the output for one and changes some ugly
output to different ugly output for another.  Additional changes in an
upcoming commit fix the latter and some other tables too.
src/output/table-select.c
tests/output/render.at