Hi Hackers,
I have encountered a bug in "
src/tools/pg_bsd_indent/lexi.c" where pgindent was incorrectly dropping the final line of a file if that line did not end with a newline character (\n). This occurred because the EOF logic triggered a termination of the processing loop before the remaining buffer was flushed to the output.
Steps to Reproduce:- Create a header/c file with some content but no newline at the very end.
- Run pgindent on those files.
- Check the file content. The file is now empty or missing the last line.
This patch ensures that had_eof states do not bypass the final buffer processing, preserving the integrity of the source code regardless of trailing whitespace.