Commit cf63a291 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

files: save the marked region only when we've prompted for a file name

Otherwise we would overwrite the current file with just the selection.

This fixes https://savannah.gnu.org/bugs/?52482.
parent 7c3c9420
Showing with 1 addition and 1 deletion
+1 -1
......@@ -2242,7 +2242,7 @@ int do_writeout(bool exiting, bool withprompt)
* function is disabled, since it allows reading from or
* writing to files not specified on the command line. */
#ifndef NANO_TINY
if (openfile->mark && !exiting && !ISSET(RESTRICTED))
if (openfile->mark && !exiting && withprompt && !ISSET(RESTRICTED))
result = write_marked_file(answer, NULL, FALSE, method);
else
#endif
......
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