Skip to content

Fix: clamp alignment padding to avoid makeslice panic - #730

Open
TheRodzz wants to merge 1 commit into
charmbracelet:mainfrom
TheRodzz:fix-makeslice-panic
Open

Fix: clamp alignment padding to avoid makeslice panic#730
TheRodzz wants to merge 1 commit into
charmbracelet:mainfrom
TheRodzz:fix-makeslice-panic

Conversation

@TheRodzz

Copy link
Copy Markdown

Fixes #729. This PR adds a sensible ceiling to the amount of padding added by text alignment functions, which prevents the Go runtime from panicking with makeslice: len out of range when extreme values like math.MaxInt are passed to width or height methods.

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.

Style.Width()/Height() panic ("makeslice: len out of range") on extreme values instead of clamping

1 participant