[hackers] [sbase] Restore state of buffer in errors || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 14 Dec 2015 15:52:59 +0100 (CET)

commit 0cd385d16413e631222cdd73d141d4cb72b854a1
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Mon Dec 14 15:38:46 2015 +0100
Commit: sin <sin_AT_2f30.org>
CommitDate: Mon Dec 14 14:52:53 2015 +0000

    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.

diff --git a/ed.c b/ed.c
index b6b74a2..1944fae 100644
--- a/ed.c
+++ b/ed.c
_AT_@ -62,6 +62,9 @@ static char *lastmatch;
 static struct undo udata;
 static int newcmd;
 
+
+static void undo(void);
+
 static void
 error(char *msg)
 {
_AT_@ -80,6 +83,9 @@ error(char *msg)
                         /* nothing */;
         }
 
+ if (!newcmd)
+ undo();
+ curln = ocurln;
         longjmp(savesp, 1);
 }
 
Received on Mon Dec 14 2015 - 15:52:59 CET

This archive was generated by hypermail 2.3.0 : Mon Dec 14 2015 - 16:00:19 CET