Skip to content

Commit

Permalink
fix: handle narrow windows with long divider
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Sep 5, 2024
1 parent 73e67dc commit aa0dce7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/divider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ export function Divider({
? terminalWidth - textPadding - padding
: // otherwise, use the provided width
width

// Don't render if the available width is less than the title width
if (widthToUse < titleWidth) {
return
}

const dividerWidth = getSideDividerWidth(widthToUse, titleWidth)
const numberOfCharsPerSide = getNumberOfCharsPerWidth(dividerChar, dividerWidth)
const dividerSideString = dividerChar.repeat(numberOfCharsPerSide)
Expand Down

0 comments on commit aa0dce7

Please sign in to comment.