Skip to content

fix(style): support 3-value padding/margin shorthand#1089

Open
s3onghyun wants to merge 1 commit into
charmbracelet:mainfrom
s3onghyun:fix-padding-three-tokens
Open

fix(style): support 3-value padding/margin shorthand#1089
s3onghyun wants to merge 1 commit into
charmbracelet:mainfrom
s3onghyun:fix-padding-three-tokens

Conversation

@s3onghyun

Copy link
Copy Markdown

Changes

  • Fix --padding/--margin with 3 values being silently ignored. ParsePadding (style/spacing.go) handled 1, 2, and 4 tokens but had no branch for 3, so gum style --padding "1 2 3" "text" fell through to (0,0,0,0) and rendered with no padding.
  • Add the missing 3-token branch using the CSS shorthand lipgloss already supports — top / horizontal / bottom → (top, horizontal, bottom, horizontal).
  • Add style/spacing_test.go with a table test for ParsePadding (1/2/3/4 tokens). The 3-token case fails before this change and passes after; go test ./... green.

ParsePadding handled 1, 2, and 4 tokens but had no branch for 3, so
'gum style --padding "1 2 3"' fell through to (0,0,0,0) and rendered with
no padding. lipgloss supports the 3-arg CSS shorthand (top / horizontal /
bottom), so add the missing branch.

Signed-off-by: Seonghyun Hong <s3onghyun.hong@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant