diff --git a/src/terminal/new/Screen.zig b/src/terminal/new/Screen.zig index 6d35653d3..0ee165881 100644 --- a/src/terminal/new/Screen.zig +++ b/src/terminal/new/Screen.zig @@ -87,6 +87,10 @@ pub fn dumpString( break :cells cells[0..self.pages.cols]; }; + if (!pagepkg.Cell.hasText(cells)) { + blank_rows += 1; + continue; + } if (blank_rows > 0) { for (0..blank_rows) |_| try writer.writeByte('\n'); blank_rows = 0; diff --git a/src/terminal/new/page.zig b/src/terminal/new/page.zig index de88a820b..8d1bda336 100644 --- a/src/terminal/new/page.zig +++ b/src/terminal/new/page.zig @@ -198,6 +198,15 @@ pub const Row = packed struct(u18) { pub const Cell = packed struct(u32) { codepoint: u21 = 0, _padding: u11 = 0, + + /// Returns true if the set of cells has text in it. + pub fn hasText(cells: []const Cell) bool { + for (cells) |cell| { + if (cell.codepoint != 0) return true; + } + + return false; + } }; // Uncomment this when you want to do some math.