fix: always place at least one word on each line in reflow
This commit is contained in:
parent
4898f02570
commit
0251d783bf
1 changed files with 1 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue