]> git.mdlowis.com Git - projs/tide.git/commitdiff
use transaction logging for trimming whitespace
authorMichael D. Lowis <mike.lowis@gentex.com>
Wed, 26 Sep 2018 20:16:40 +0000 (16:16 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Wed, 26 Sep 2018 20:16:40 +0000 (16:16 -0400)
lib/buf.c

index 667dc5e9e43ecdc396e9572f3e62d263a3c05fec..06dfe010816edca780d9e65958aefe1d8ac72747 100644 (file)
--- 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;
 }