From 6a0ea821e901265dd129406ee7f6a708675e8119 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Fri, 4 Nov 2005 06:21:39 +0000 Subject: [PATCH] fix breakage git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3085 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- src/files.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/files.c b/src/files.c index fc2c5390..12e8b181 100644 --- a/src/files.c +++ b/src/files.c @@ -1429,8 +1429,13 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type } /* If we're on the last line of the file, don't write a newline - * character after it. */ - if (fileptr != openfile->filebot) { + * character after it. If the last line of the file is blank, + * this means that zero bytes are written, in which case we + * don't count the last line in the total lines written. */ + if (fileptr == openfile->filebot) { + if (fileptr->data[0] == '\0') + lineswritten--; + } else { #ifndef NANO_SMALL if (openfile->fmt == DOS_FILE || openfile->fmt == MAC_FILE) { -- 2.39.5