tweaks: reshuffle the setting of the starting point of a cut
parent
622111613f
commit
38af812a82
15
src/files.c
15
src/files.c
|
@ -484,25 +484,20 @@ bool replace_buffer(const char *filename, undo_type action, bool marked,
|
||||||
if (descriptor < 0)
|
if (descriptor < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
cutbuffer = NULL;
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
add_undo(COUPLE_BEGIN, operation);
|
add_undo(COUPLE_BEGIN, operation);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* When nothing is marked, start at the top of the buffer. */
|
/* Cut either the marked region or the whole 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
|
|
||||||
add_undo(action, NULL);
|
add_undo(action, NULL);
|
||||||
#endif
|
#endif
|
||||||
do_snip(FALSE, marked, !marked, FALSE);
|
do_snip(FALSE, marked, !marked, FALSE);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
update_undo(action);
|
update_undo(action);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Discard what was cut. */
|
||||||
free_lines(cutbuffer);
|
free_lines(cutbuffer);
|
||||||
cutbuffer = was_cutbuffer;
|
cutbuffer = was_cutbuffer;
|
||||||
|
|
||||||
|
|
|
@ -2561,9 +2561,14 @@ const char *treat(char *tempfile_name, char *theprogram, bool spelling)
|
||||||
openfile->mark = line_from_number(was_mark_lineno);
|
openfile->mark = line_from_number(was_mark_lineno);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
openfile->current = openfile->filetop;
|
||||||
|
openfile->current_x = 0;
|
||||||
|
|
||||||
replaced = replace_buffer(tempfile_name, CUT_TO_EOF, FALSE,
|
replaced = replace_buffer(tempfile_name, CUT_TO_EOF, FALSE,
|
||||||
/* TRANSLATORS: The next two go with Undid/Redid messages. */
|
/* TRANSLATORS: The next two go with Undid/Redid messages. */
|
||||||
(spelling ? N_("spelling correction") : N_("formatting")));
|
(spelling ? N_("spelling correction") : N_("formatting")));
|
||||||
|
}
|
||||||
|
|
||||||
/* Go back to the old position. */
|
/* Go back to the old position. */
|
||||||
goto_line_posx(lineno_save, current_x_save);
|
goto_line_posx(lineno_save, current_x_save);
|
||||||
|
|
Loading…
Reference in New Issue