Skip to content

Commit 85fe1cf

Browse files
committed
std.Progress: skip printing root node when it is empty
1 parent b25a684 commit 85fe1cf

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/std/Progress.zig

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ const SavedMetadata = extern struct {
592592

593593
fn serializeIpc(start_serialized_len: usize) usize {
594594
var serialized_len = start_serialized_len;
595-
var pipe_buf: [4096]u8 align(4) = undefined;
595+
var pipe_buf: [2 * 4096]u8 align(4) = undefined;
596596

597597
main_loop: for (
598598
serialized_node_parents_buffer[0..serialized_len],
@@ -836,10 +836,13 @@ fn computeNode(
836836
}
837837
}
838838

839-
i = @min(global_progress.cols + start_i, i);
840-
buf[i] = '\n';
841-
i += 1;
842-
global_progress.newline_count += 1;
839+
const is_empty_root = @intFromEnum(node_index) == 0 and serialized.storage[0].name[0] == 0;
840+
if (!is_empty_root) {
841+
i = @min(global_progress.cols + start_i, i);
842+
buf[i] = '\n';
843+
i += 1;
844+
global_progress.newline_count += 1;
845+
}
843846

844847
if (global_progress.newline_count < global_progress.rows) {
845848
if (children[@intFromEnum(node_index)].child.unwrap()) |child| {

0 commit comments

Comments
 (0)