fix(ascii): fix the calculation of the alignment buffer size

This commit is contained in:
utox39
2025-09-10 14:26:11 +02:00
parent 20e2ef80d2
commit f7641c24a3

View File

@@ -115,7 +115,7 @@ pub fn printAscii(allocator: std.mem.Allocator, ascii_art_path: ?[]u8, sys_info_
while (i < max_len) : (i += 1) { while (i < max_len) : (i += 1) {
// Print the ascii art if the width of the terminal is greater than the spacing (5) + the longest ascii art row length + the longest sys info string length // Print the ascii art if the width of the terminal is greater than the spacing (5) + the longest ascii art row length + the longest sys info string length
if (can_print_ascii_art) { if (can_print_ascii_art) {
const alignment_buffer = try allocator.alloc(u8, longest_ascii_art_row_len - (try utils.countCodepoints(ascii_art_items[i])) + spacing); const alignment_buffer = try allocator.alloc(u8, if (i < ascii_art_len) longest_ascii_art_row_len - (try utils.countCodepoints(ascii_art_items[i])) + spacing else longest_ascii_art_row_len + spacing);
@memset(alignment_buffer, ' '); @memset(alignment_buffer, ' ');
if (i < ascii_art_len) { if (i < ascii_art_len) {