2
0
mirror of https://github.com/rivo/tview.git synced 2024-11-19 03:25:34 +00:00

make sure the limits aren't past screen limit

This commit is contained in:
Joe Grasse 2018-03-15 14:02:38 -05:00
parent 258c9d1f8e
commit e8d76452de

10
form.go
View File

@ -264,6 +264,16 @@ func (f *Form) Draw(screen tcell.Screen) {
rightLimit := x + width
startX := x
// make sure limits aren't past the screen dimensions
sw, sh := screen.Size()
if rightLimit > sw {
rightLimit = sw
}
if bottomLimit > sh {
bottomLimit = sh
}
// Find the longest label.
var maxLabelWidth int
for _, item := range f.items {