peridot/vendor/github.com/vbauerster/mpb/v7/internal/width.go

11 lines
250 B
Go
Raw Permalink Normal View History

2022-07-07 20:11:50 +00:00
package internal
// CheckRequestedWidth checks that requested width doesn't overflow
// available width
func CheckRequestedWidth(requested, available int) int {
if requested < 1 || requested >= available {
return available
}
return requested
}