redefine col_num for uneven rows

In first for loop of print_cheatsheet(), redefine col_num if current iteration is null, and break the loop.
This commit is contained in:
John Haugabook 2025-07-30 12:33:34 -04:00 committed by GitHub
parent 6143576a69
commit cf2057b395
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -446,6 +446,10 @@ static void print_cheatsheet(int i, int col_num)
/* The headers */
if(cheat_items[c + i].heading[0])
printf("%-30s ", cheat_items[c + i].heading[0]);
else {
col_num = c; /* redefine for uneven rows */
break;
}
}
puts("");
for(c = 0; c < col_num; c++)