Merge pull request #3157 from Master-Guy/issues/2462

Quick fix to prevent division by 0
This commit is contained in:
hydroflame 2022-03-17 12:04:23 -04:00 committed by GitHub
commit 12527c501a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -167,7 +167,7 @@ export function ls(
function postSegments(segments: string[], style?: any, linked?: boolean): void { function postSegments(segments: string[], style?: any, linked?: boolean): void {
const maxLength = Math.max(...segments.map((s) => s.length)) + 1; const maxLength = Math.max(...segments.map((s) => s.length)) + 1;
const filesPerRow = Math.floor(80 / maxLength); const filesPerRow = Math.ceil(80 / maxLength);
for (let i = 0; i < segments.length; i++) { for (let i = 0; i < segments.length; i++) {
let row = ""; let row = "";
for (let col = 0; col < filesPerRow; col++) { for (let col = 0; col < filesPerRow; col++) {