Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › Progress › maybeUpdateSize Private Function maybeUpdateSize Doc Source Private Function std.Progress.maybeUpdateSize
fn maybeUpdateSize (io : Io , resize_flag : bool ) !void Params File Progress.zig: 1543
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584 fn maybeUpdateSize (io : Io , resize_flag : bool ) !void {
if (!resize_flag ) return ;
const file = global_progress .terminal ;
if (is_windows ) {
var get_console_info = windows .CONSOLE .USER_IO .GET_SCREEN_BUFFER_INFO ;
switch (try get_console_info .operate (io , file )) {
.SUCCESS => {
global_progress .rows = @intCast (get_console_info .Data .dwWindowSize .Y );
global_progress .cols = @intCast (get_console_info .Data .dwWindowSize .X );
},
else => {
std .log .debug ("failed to determine terminal size; using conservative guess 80x25" , .{});
global_progress .rows = 25 ;
global_progress .cols = 80 ;
},
}
} else {
var winsize : posix .winsize = .{
.row = 0 ,
.col = 0 ,
.xpixel = 0 ,
.ypixel = 0 ,
};
const err = (try io .operate (.{ .device_io_control = .{
.file = file ,
.code = posix .T .IOCGWINSZ ,
.arg = &winsize ,
} })).device_io_control ;
if (err >= 0 ) {
global_progress .rows = winsize .row ;
global_progress .cols = winsize .col ;
} else {
std .log .debug ("failed to determine terminal size; using conservative guess 80x25" , .{});
global_progress .rows = 25 ;
global_progress .cols = 80 ;
}
}
}