From: Michael D. Lowis Date: Wed, 26 Sep 2018 20:16:40 +0000 (-0400) Subject: use transaction logging for trimming whitespace X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=fa232f747a4a8fb398d62c2ba5b3a569aa363d12;p=projs%2Ftide.git use transaction logging for trimming whitespace --- diff --git a/lib/buf.c b/lib/buf.c index 667dc5e..06dfe01 100644 --- a/lib/buf.c +++ b/lib/buf.c @@ -156,6 +156,7 @@ static void trim_whitespace(Buf* buf) { if (swapped) sel = selswap(sel); unsigned prev = 1; buf->selection.beg = buf->selection.end = 0; + buf_logstart(buf); while (buf->selection.end < buf_end(buf) && prev != buf->selection.end) { int r = getb(buf, buf->selection.end); /* If we reached a newline, then delete whatever we have selected */ @@ -175,6 +176,7 @@ static void trim_whitespace(Buf* buf) { prev = buf->selection.end; buf->selection.end = buf_byrune(buf, buf->selection.end, +1); } + buf_logstop(buf); if (swapped) sel = selswap(sel); buf->selection = sel; }