Commit 1a8b296a authored by Chris Allegretta's avatar Chris Allegretta
Browse files

write_file() - Increment lineswritten when the very last line isn't null....

write_file()  - Increment lineswritten when the very last line isn't null. Fixes off by one count when writing selection to file.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@704 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 3 additions and 3 deletions
+3 -3
...@@ -121,7 +121,4 @@ ...@@ -121,7 +121,4 @@
** Open BUGS ** ** Open BUGS **
Informal note - when using marked write to file, the number of lines
written is off by one. Delete this message when fixed.
$Id$ $Id$
...@@ -93,6 +93,8 @@ Cvs code - ...@@ -93,6 +93,8 @@ Cvs code -
write_file() write_file()
- New arg, nonamechange, means whether or not to update the - New arg, nonamechange, means whether or not to update the
current filename after writing the file out. current filename after writing the file out.
- Increment lineswritten when the very last line isn't null.
Fixes off by one count when writing selection to file.
- global.c: - global.c:
- Updated some of the lists for the "Goto Directory" code (Rocco) - Updated some of the lists for the "Goto Directory" code (Rocco)
- move.c: - move.c:
......
...@@ -448,6 +448,7 @@ int write_file(char *name, int tmp, int append, int nonamechange) ...@@ -448,6 +448,7 @@ int write_file(char *name, int tmp, int append, int nonamechange)
return -1; return -1;
} else if (size > 0) { } else if (size > 0) {
size = write(fd, "\n", 1); size = write(fd, "\n", 1);
lineswritten++;
if (size == -1) { if (size == -1) {
statusbar(_("Could not open file for writing: %s"), statusbar(_("Could not open file for writing: %s"),
strerror(errno)); strerror(errno));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment