![]() |
Ok, here's a better patch for 'textfmt'. This one yields fewer blank pages - a file that ends in a formfeed produces the same number of pages that a file omitting the formfeed does. If a formfeed is coincident with a page break that's generated by 'textfmt' (this is the bug you found) because the number of line per page has been reached, 'textfmt' will not put in an extra blank page. And, another unrelated bug is fixed - for a file that contains a single character, with no linefeed at the end.
*** TextFmt.c++.orig Thu Feb 14 23:52:21 2002 --- TextFmt.c++ Wed Oct 16 17:23:21 2002 *************** *** 688,693 **** --- 688,695 ---- void TextFmt::endFile(void) { + if (!bot) + endTextLine(); if (!bol) endLine(); if (!bop) { *************** *** 758,765 **** case '\0': // discard nulls break; case '\f': // form feed ! endTextCol(); ! bol = bot = true; break; case '\n': // line break if (bol) --- 760,769 ---- case '\0': // discard nulls break; case '\f': // form feed ! if (!bop) { ! endTextCol(); ! bol = bot = true; ! } break; case '\n': // line break if (bol) *************** *** 849,856 **** case '\0': // discard nulls break; case '\f': // form feed ! endTextCol(); ! bol = bot = true; break; case '\n': // line break if (bol) --- 853,862 ---- case '\0': // discard nulls break; case '\f': // form feed ! if (!bop) { ! endTextCol(); ! bol = bot = true; ! } break; case '\n': // line break if (bol)