commit b15c5a7eafef10775ac20f2a57f0f6cc9247a0c8
parent 1b1d60b9d743c2ee7cacfa27cdd4de52ea6c02bf
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Tue, 25 Feb 2020 17:35:10 +0100
tweaks: abort in three situations that should never occur
Since is_cuttable() was added just over a year ago, ^K will
not add an undo item when it doesn't actually cut anything.
Diffstat:
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/text.c b/src/text.c
@@ -473,9 +473,8 @@ void undo_cut(undostruct *u)
else
goto_line_posx(u->mark_begin_lineno, u->mark_begin_x);
- /* If nothing was actually cut, positioning the cursor was enough. */
if (!u->cutbuffer)
- return;
+ die("Empty cut -- please report a bug\n");
copy_from_buffer(u->cutbuffer);
@@ -496,9 +495,8 @@ void redo_cut(undostruct *u)
goto_line_posx(u->lineno, u->begin);
- /* If nothing was actually cut, positioning the cursor was enough. */
if (!u->cutbuffer)
- return;
+ die("Empty paste -- please report a bug\n");
cutbuffer = NULL;
@@ -1345,7 +1343,7 @@ void update_undo(undo_type action)
case CUT_TO_EOF:
case CUT:
if (!cutbuffer)
- break;
+ die("Adding empty undo item -- please report a bug\n");
if (u->type == ZAP)
u->cutbuffer = cutbuffer;
else {