tweaks: prevent the adding of an unwanted newline in a different way

The prevention is needed only for temporary files, not for normal files.
This commit is contained in:
Benno Schulenberg 2022-03-27 18:20:17 +02:00
parent 3def429290
commit 0f23729253
2 changed files with 1 additions and 4 deletions

View File

@ -2085,7 +2085,7 @@ bool write_region_to_file(const char *name, FILE *stream, bool normal,
get_region(&topline, &top_x, &botline, &bot_x);
/* When needed, prepare a magic end line for the region. */
if (bot_x > 0 && !ISSET(NO_NEWLINES)) {
if (normal && bot_x > 0 && !ISSET(NO_NEWLINES)) {
stopper = make_new_node(botline);
stopper->data = copy_of("");
} else

View File

@ -2516,9 +2516,6 @@ void do_spell(void)
/* Save the settings of the global flags. */
memcpy(stash, flags, sizeof(flags));
/* Don't add an extra newline when writing out the (selected) text. */
SET(NO_NEWLINES);
#ifndef NANO_TINY
if (openfile->mark)
okay = write_region_to_file(temp_name, stream, TEMPORARY, OVERWRITE);