summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2024-01-09 23:26:15 +0100
committerEkaitz Zarraga <ekaitz@elenq.tech>2024-01-09 23:26:15 +0100
commit49035a91a14242f4f140d17af8ebd91670e128f2 (patch)
tree74403d967c3743ed3037f905493c00aedf038d19
parent67f7a5e9eba1e97b975b2d5cd8a29aef404f9149 (diff)
par: piece-table: don't add empty pieces!
-rw-r--r--par/piece-table.scm5
1 files changed, 4 insertions, 1 deletions
diff --git a/par/piece-table.scm b/par/piece-table.scm
index 9f967c0..1c2940f 100644
--- a/par/piece-table.scm
+++ b/par/piece-table.scm
@@ -172,7 +172,10 @@
(can-merge-pieces? piece candidate))
(append! beg (list (merge-pieces! piece candidate)) end)
(let-values (((first second) (split-piece! piece rem)))
- (append! beg (list first candidate second) end))))))
+ (append! beg
+ (remove (lambda (p) (= 0 (piece-length p)))
+ (list first candidate second))
+ end))))))
; TODO: SET-CDR for the win?