diff --git a/src/Window.zig b/src/Window.zig index f8c2c44..0a02098 100644 --- a/src/Window.zig +++ b/src/Window.zig @@ -289,6 +289,10 @@ pub fn print(self: Window, segments: []const Segment, opts: PrintOptions) !Print const overflow: bool = blk: for (segments) |segment| { var iter = self.screen.unicode.graphemeIterator(segment.text); while (iter.next()) |grapheme| { + if (col >= self.width) { + row += 1; + col = 0; + } if (row >= self.height) break :blk true; const s = grapheme.bytes(segment.text); if (std.mem.eql(u8, s, "\n")) { @@ -296,10 +300,6 @@ 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, .{ @@ -313,7 +313,10 @@ pub fn print(self: Window, segments: []const Segment, opts: PrintOptions) !Print col += w; } } else false; - + if (col >= self.width) { + row += 1; + col = 0; + } return .{ .row = row, .col = col,