diff --git a/src/components/table.ts b/src/components/table.ts index b7907c3..7bc052c 100644 --- a/src/components/table.ts +++ b/src/components/table.ts @@ -235,7 +235,9 @@ export class Table extends Component { let value = ""; for (const header of headers) { - value += header.title + " ".repeat(header.width + 1 - textWidth(header.title)); + // Ensures non-negative numbers + const endPadding = Math.max(0, header.width + 1 - textWidth(header.title)); + value += header.title + " ".repeat(endPadding); } return value;