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:
parent
13e0b6c605
commit
0cd385d164
6
ed.c
6
ed.c
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user