window(wrap): fix when we shift to new line

Add a newline at the top of the loop instead of the bottom
This commit is contained in:
Tim Culverhouse 2024-05-23 20:15:14 -05:00
parent 465c01e403
commit a9a0abf16b

View file

@ -296,6 +296,10 @@ pub fn print(self: Window, segments: []const Segment, opts: PrintOptions) !Print
col = 0;
continue;
}
if (col >= self.width) {
row += 1;
col = 0;
}
const w = self.gwidth(s);
if (w == 0) continue;
if (opts.commit) self.writeCell(col, row, .{
@ -307,10 +311,6 @@ pub fn print(self: Window, segments: []const Segment, opts: PrintOptions) !Print
.link = segment.link,
});
col += w;
if (col >= self.width) {
row += 1;
col = 0;
}
}
} else false;