Restore state of buffer in errors

When a error occurs it is important to remove all the modifications
done by the offending command and restore the value of dot to the
state before of executing the command.
This commit is contained in:
Roberto E. Vargas Caballero 2015-12-14 15:38:46 +01:00 committed by sin
parent 13e0b6c605
commit 0cd385d164

6
ed.c
View File

@ -62,6 +62,9 @@ static char *lastmatch;
static struct undo udata; static struct undo udata;
static int newcmd; static int newcmd;
static void undo(void);
static void static void
error(char *msg) error(char *msg)
{ {
@ -80,6 +83,9 @@ error(char *msg)
/* nothing */; /* nothing */;
} }
if (!newcmd)
undo();
curln = ocurln;
longjmp(savesp, 1); longjmp(savesp, 1);
} }