From 0251d783bfb6736d09f13efd540bdeccc5fa8b07 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Sun, 1 Feb 2026 20:48:42 +0100 Subject: [PATCH] fix: always place at least one word on each line in reflow --- src/buffer/reflow.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/buffer/reflow.zig b/src/buffer/reflow.zig index 3f8fe39..7cda022 100644 --- a/src/buffer/reflow.zig +++ b/src/buffer/reflow.zig @@ -27,7 +27,7 @@ pub fn reflow(allocator: std.mem.Allocator, text: []const u8, width: usize) erro continue :blk .words; }, .words => { - if (line_len + word.len + 1 >= width - 1) { + if (line_len > prefix.len and line_len + word.len + 1 >= width - 1) { try writer.writeByte('\n'); line_len = 0; continue :blk .begin;