Skip to content

Commit

Permalink
fix(dev): fix crash on very narrow terminals (#5327)
Browse files Browse the repository at this point in the history
Before this fix, commands in a dev command session would fail with an
error if the terminal width was less than the length of the command
(including opts and args).
  • Loading branch information
thsig authored Nov 1, 2023
1 parent e1738ac commit 4af4d6c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/logger/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ interface DividerOpts {
padding?: number
}

const getSideDividerWidth = (width: number, titleWidth: number) => (width - titleWidth) / 2
const getSideDividerWidth = (width: number, titleWidth: number) => Math.max((width - titleWidth) / 2, 1)
const getNumberOfCharsPerWidth = (char: string, width: number) => width / stringWidth(char)

// Adapted from https://github.com/JureSotosek/ink-divider
Expand Down

0 comments on commit 4af4d6c

Please sign in to comment.