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.
master
Benno Schulenberg 2020-02-25 17:35:10 +01:00
parent 1b1d60b9d7
commit b15c5a7eaf
1 changed files with 3 additions and 5 deletions

View File

@ -473,9 +473,8 @@ void undo_cut(undostruct *u)
else else
goto_line_posx(u->mark_begin_lineno, u->mark_begin_x); goto_line_posx(u->mark_begin_lineno, u->mark_begin_x);
/* If nothing was actually cut, positioning the cursor was enough. */
if (!u->cutbuffer) if (!u->cutbuffer)
return; die("Empty cut -- please report a bug\n");
copy_from_buffer(u->cutbuffer); copy_from_buffer(u->cutbuffer);
@ -496,9 +495,8 @@ void redo_cut(undostruct *u)
goto_line_posx(u->lineno, u->begin); goto_line_posx(u->lineno, u->begin);
/* If nothing was actually cut, positioning the cursor was enough. */
if (!u->cutbuffer) if (!u->cutbuffer)
return; die("Empty paste -- please report a bug\n");
cutbuffer = NULL; cutbuffer = NULL;
@ -1345,7 +1343,7 @@ void update_undo(undo_type action)
case CUT_TO_EOF: case CUT_TO_EOF:
case CUT: case CUT:
if (!cutbuffer) if (!cutbuffer)
break; die("Adding empty undo item -- please report a bug\n");
if (u->type == ZAP) if (u->type == ZAP)
u->cutbuffer = cutbuffer; u->cutbuffer = cutbuffer;
else { else {