From 992c7369862e8fa63924ce73a3c4b2cdf66db057 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 13 Mar 2024 09:28:17 -0700 Subject: [PATCH] terminal: dumpScreen handles wrap --- src/terminal/Screen.zig | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/terminal/Screen.zig b/src/terminal/Screen.zig index 846d312da..50ff93fe2 100644 --- a/src/terminal/Screen.zig +++ b/src/terminal/Screen.zig @@ -1691,6 +1691,7 @@ pub fn dumpString( var iter = opts.tl.rowIterator(.right_down, opts.br); while (iter.next()) |row_offset| { const rac = row_offset.rowAndCell(); + const row = rac.row; const cells = cells: { const cells: [*]pagepkg.Cell = @ptrCast(rac.cell); break :cells cells[0..self.pages.cols]; @@ -1705,8 +1706,12 @@ pub fn dumpString( blank_rows = 0; } - // TODO: handle wrap - blank_rows += 1; + if (!row.wrap or !opts.unwrap) { + // If we're not wrapped, we always add a newline. + // If we are wrapped, we only add a new line if we're unwrapping + // soft-wrapped lines. + blank_rows += 1; + } var blank_cells: usize = 0; for (cells) |*cell| {