commit 619962ee1895efc1f5b1ea19c8098d48c78e93ca
parent 7ebe44ac251a66647ff8b2066296b393ba9836ce
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 29 Mar 2020 14:21:44 +0200
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.
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/text.c b/src/text.c
@@ -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);