From b9a73cf75396fa9b526328b925cf6890086528ed Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Tue, 22 Nov 2016 20:37:13 -0500 Subject: [PATCH] initialize undone operations to locked to prevent some coalescing new edits with undone/redone edits --- libedit/buf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libedit/buf.c b/libedit/buf.c index 6b4ddfc..1734302 100644 --- a/libedit/buf.c +++ b/libedit/buf.c @@ -94,6 +94,7 @@ static void log_insert(Log** list, unsigned beg, unsigned end) { newlog->data.ins.beg = beg; newlog->data.ins.end = end; newlog->next = *list; + if (log) log->locked = true; *list = newlog; } else if (beg <= log->data.ins.beg) { log->data.ins.beg--; @@ -114,6 +115,7 @@ static void log_delete(Log** list, unsigned off, Rune* r, size_t len) { for (size_t i = 0; i < len; i++) newlog->data.del.runes[i] = r[i]; newlog->next = *list; + if (log) log->locked = true; *list = newlog; } else if (off == log->data.del.off) { log->data.del.len++; @@ -162,6 +164,7 @@ unsigned swaplog(Buf* buf, Log** from, Log** to, unsigned pos) { *from = log->next; /* invert the log type and move it to the destination */ Log* newlog = (Log*)calloc(sizeof(Log), 1); + newlog->locked = true; if (log->insert) { newlog->insert = false; size_t n = (log->data.ins.end - log->data.ins.beg); -- 2.52.0