File: width.go

package info (click to toggle)
golang-github-vbauerster-mpb 8.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,044 kB
  • sloc: sh: 7; makefile: 3
file content (10 lines) | stat: -rw-r--r-- 249 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
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
}