tweaks: reshuffle the setting of the starting point of a cut

master
Benno Schulenberg 2020-03-06 16:57:22 +01:00
parent 622111613f
commit 38af812a82
2 changed files with 10 additions and 10 deletions

View File

@ -484,25 +484,20 @@ bool replace_buffer(const char *filename, undo_type action, bool marked,
if (descriptor < 0)
return FALSE;
cutbuffer = NULL;
#ifndef NANO_TINY
add_undo(COUPLE_BEGIN, operation);
#endif
/* When nothing is marked, start at the top of the buffer. */
if (!marked) {
openfile->current = openfile->filetop;
openfile->current_x = 0;
}
/* Throw away the marked region or the whole buffer. */
cutbuffer = NULL;
#ifndef NANO_TINY
/* Cut either the marked region or the whole buffer. */
add_undo(action, NULL);
#endif
do_snip(FALSE, marked, !marked, FALSE);
#ifndef NANO_TINY
update_undo(action);
#endif
/* Discard what was cut. */
free_lines(cutbuffer);
cutbuffer = was_cutbuffer;

View File

@ -2561,9 +2561,14 @@ const char *treat(char *tempfile_name, char *theprogram, bool spelling)
openfile->mark = line_from_number(was_mark_lineno);
} else
#endif
{
openfile->current = openfile->filetop;
openfile->current_x = 0;
replaced = replace_buffer(tempfile_name, CUT_TO_EOF, FALSE,
/* TRANSLATORS: The next two go with Undid/Redid messages. */
(spelling ? N_("spelling correction") : N_("formatting")));
}
/* Go back to the old position. */
goto_line_posx(lineno_save, current_x_save);