sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit 9ad2dd0d315a2fe5bf9a07b6f2284f76810744ba
parent e90a049450b4214e2aaf6cfa48636766e1020167
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon Dec 14 15:38:46 +0100

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.

Diffstat:
ed.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/ed.c b/ed.c @@ -62,6 +62,9 @@ static char *lastmatch; static struct undo udata; static int newcmd; + +static void undo(void); + static void error(char *msg) { @@ -80,6 +83,9 @@ error(char *msg) /* nothing */; } + if (!newcmd) + undo(); + curln = ocurln; longjmp(savesp, 1); }