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 library itself.
Zig › compiler/ › resinator/ › errors.zig › cellCount
cellCount
errors.cellCount
fn cellCount (code_page : SupportedCodePage , source : []const u8 , start_index : usize , end_index : usize ) usize
File
Code
fn cellCount (code_page : SupportedCodePage , source : []const u8 , start_index : usize , end_index : usize ) usize {
// involve full grapheme cluster awareness + grapheme width data, but oh well.
var codepoint_count : usize = 0 ;
var index : usize = start_index ;
while (index < end_index ) {
const codepoint = code_page .codepointAt (index , source ) orelse break ;
defer index += codepoint .byte_len ;
_ = codepointForDisplay (codepoint ) orelse continue ;
codepoint_count += 1 ;
if (codepoint_count >= max_source_line_codepoints + truncated_str .len ) break ;
}
return codepoint_count ;
}