When undoing a cut-till-end-of-file, put the cursor back

where the cut started, and not at the bottom of the file.
Patch by Mark Majeres.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5005 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2014-06-21 19:32:17 +00:00
parent f80dcb2b25
commit 76e150b47f
2 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2014-06-21 Mark Majeres <mark@engine12.com>
* src/text.c (undo_cut, add_undo): When undoing a cut-till-eof,
put the cursor back where the cut started, and not at the end.
2014-06-21 David Lawrence Ramsey <pooka109@gmail.com>
* src/move.c, src/nano.c: Miscellaneous whitespace fixes, one
type fix, and one more #ifdef NANO_TINY.

View File

@ -396,7 +396,7 @@ void undo_cut(undo *u)
free_filestruct(cutbuffer);
cutbuffer = NULL;
if (u->xflags == UNcut_cutline || u->xflags == UNcut_marked_backwards)
if (u->xflags == UNcut_cutline || u->xflags == UNcut_marked_backwards || u->type == CUT_EOF)
goto_line_posx(u->mark_begin_lineno, u->mark_begin_x);
}
@ -937,6 +937,8 @@ void add_undo(undo_type current_action)
u->strdata = data;
break;
case CUT_EOF:
cutbuffer_reset();
break;
case CUT:
cutbuffer_reset();
u->mark_set = openfile->mark_set;
@ -944,7 +946,7 @@ void add_undo(undo_type current_action)
u->mark_begin_lineno = openfile->mark_begin->lineno;
u->mark_begin_x = openfile->mark_begin_x;
}
else if (!ISSET(CUT_TO_END) && u->type != CUT_EOF) {
else if (!ISSET(CUT_TO_END)) {
/* The entire line is being cut regardless of the cursor position. */
u->begin = 0;
u->xflags = UNcut_cutline;