From a9a0abf16b30a0500fde2193b5a66699059c4529 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Thu, 23 May 2024 20:15:14 -0500 Subject: [PATCH] window(wrap): fix when we shift to new line Add a newline at the top of the loop instead of the bottom --- src/Window.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Window.zig b/src/Window.zig index f39b6e6..f8c2c44 100644 --- a/src/Window.zig +++ b/src/Window.zig @@ -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;