Backport #16678 When files are highlighted the newline character needs to be added in a whitespace compliant mode. Also ensure the final empty newline is rendered. Fix #16434 Signed-off-by: Andrew Thornton <art27@cantab.net>