From: Michael D. Lowis Date: Tue, 4 Sep 2018 20:20:56 +0000 (-0400) Subject: added functions for log start and stop X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=dc1936f3972c9ba441bd6d2253669a3bbb97fdcb;p=projs%2Ftide.git added functions for log start and stop --- diff --git a/inc/edit.h b/inc/edit.h index 02f2a59..153bbda 100644 --- a/inc/edit.h +++ b/inc/edit.h @@ -49,6 +49,8 @@ void buf_del(Buf* buf); void buf_undo(Buf* buf); void buf_redo(Buf* buf); +void buf_logstart(Buf* buf); +void buf_logstop(Buf* buf); void buf_logclear(Buf* buf); void buf_lastins(Buf* buf); diff --git a/lib/buf.c b/lib/buf.c index b0c634b..169848d 100644 --- a/lib/buf.c +++ b/lib/buf.c @@ -231,6 +231,15 @@ static void log_swap(Buf* buf, Log** src, Log** dest) { dumplog(buf); } +void buf_logstart(Buf* buf) { + buf->transid = abs(buf->transid); +} + +void buf_logstop(Buf* buf) { + if (buf->transid > 0) + buf->transid = -(buf->transid + 1); +} + void buf_undo(Buf* buf) { log_swap(buf, &(buf->undo), &(buf->redo)); }