ascii_flush() was not actually flushing the contents of the page, so this
commit changes it to do that.
This change made it clear that the proper place to reset the "y" position
on the page is in ascii_close_page(), so it makes that change too.
ascii_flush (struct output_driver *driver)
{
struct ascii_driver *a = ascii_driver_cast (driver);
- if (a->file != NULL)
- fflush (a->file);
+ if (a->y > 0)
+ {
+ ascii_close_page (a);
+
+ if (fn_close (a->file_name, a->file) != 0)
+ error (0, errno, _("ascii: closing output file \"%s\""),
+ a->file_name);
+ a->file = NULL;
+ }
}
static void
}
if (a->file == NULL)
- {
- ascii_open_page (a);
- a->y = 0;
- }
+ ascii_open_page (a);
page = render_page_create (¶ms, table_item_get_table (table_item));
for (render_break_init (&x_break, page, H);
{
assert (a->y > 0);
ascii_close_page (a);
- a->y = 0;
ascii_open_page (a);
continue;
}
putc ('\n', a->file);
if (a->paginate)
putc ('\f', a->file);
+
+ a->y = 0;
}