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:
parent
258c9d1f8e
commit
e8d76452de
10
form.go
10
form.go
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user