nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] fixing bug #51040


From: Benno Schulenberg
Subject: [Nano-devel] fixing bug #51040
Date: Sun, 24 Sep 2017 12:45:23 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0


Op 21-09-2017 om 00:52 schreef Viorel Bota:
I followed your indications and implemented a proposal that avoids duplicating 
code.

Changes remain isolated in the function "do_writeout(bool exiting)" from source file "files.c".

The solution is in the attachment.

Thanks.  The patch... mostly works.  But it forgets to initialize i to 0,
and when using --tempfile and writing of the file fails (because the file
was made unwritable in the meantime, say), it becomes impossible to exit
from nano when the buffer was modified.

Furthermore, when the "File was modified" prompt comes up and you press ^C,
the prompt bar is not cleared.  And when the user answers "No", nano should
probably act the same as for Cancel -- it should only discard the buffer if
the user actively chooses to do so, via ^O ^Q.

All these problems are easily fixed, so I have done that.

Your patch also *improves* the behavior of nano when --tempfile is used
and writing of the modified buffer fails.  Currently, when that happens,
there is no error message, there is no indication why the writing failed,
nano immediately goes on to prompt for a file name.  My first response was
to press ^C and then try ^X again.  Same result.  Your patch changes this
so that nano just shows the error message and takes no further action,
which I like better.

In the attached patch I have fixed all the above issues, and adjusted all
the formatting and whitespace errors as well.  Please test, and report
whether you are okay with this version, Viorel.

Oh!  Only after changing all that, I realize that the patch does not cover
the case of 'savefile'!  I now have fixed that too, by adding a parameter
to do_ write_out(), as predicted.

Benno

Attachment: 0001-files-check-for-a-changed-disk-file-also-for-savefil.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]