mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-17 09:16:11 +03:00
terminal/new: detect empty rows
This commit is contained in:
@ -87,6 +87,10 @@ pub fn dumpString(
|
|||||||
break :cells cells[0..self.pages.cols];
|
break :cells cells[0..self.pages.cols];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!pagepkg.Cell.hasText(cells)) {
|
||||||
|
blank_rows += 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (blank_rows > 0) {
|
if (blank_rows > 0) {
|
||||||
for (0..blank_rows) |_| try writer.writeByte('\n');
|
for (0..blank_rows) |_| try writer.writeByte('\n');
|
||||||
blank_rows = 0;
|
blank_rows = 0;
|
||||||
|
@ -198,6 +198,15 @@ pub const Row = packed struct(u18) {
|
|||||||
pub const Cell = packed struct(u32) {
|
pub const Cell = packed struct(u32) {
|
||||||
codepoint: u21 = 0,
|
codepoint: u21 = 0,
|
||||||
_padding: u11 = 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.
|
// Uncomment this when you want to do some math.
|
||||||
|
Reference in New Issue
Block a user