undo: when undoing a line cut, place the cursor back where it was

This fixes https://savannah.gnu.org/bugs/?58074.

Bug existed since version 4.9, commit ac612545.
This commit is contained in:
Benno Schulenberg 2020-03-29 14:21:44 +02:00
parent 7ebe44ac25
commit 619962ee18
1 changed files with 3 additions and 2 deletions

View File

@ -1030,9 +1030,10 @@ void add_undo(undo_type action, const char *message)
u->xflags |= INCLUDED_LAST_LINE;
} else if (!ISSET(CUT_FROM_CURSOR)) {
/* The entire line is being cut regardless of the cursor position. */
u->xflags |= WAS_WHOLE_LINE;
u->xflags |= (WAS_WHOLE_LINE | CURSOR_WAS_AT_HEAD);
u->tail_x = 0;
}
} else
u->xflags |= CURSOR_WAS_AT_HEAD;
break;
case PASTE:
u->cutbuffer = copy_buffer(cutbuffer);