From dc1936f3972c9ba441bd6d2253669a3bbb97fdcb Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Tue, 4 Sep 2018 16:20:56 -0400 Subject: [PATCH] added functions for log start and stop --- inc/edit.h | 2 ++ lib/buf.c | 9 +++++++++ 2 files changed, 11 insertions(+) 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)); } -- 2.49.0