Set DropDown options list width to at least as wide as the originating field

This commit is contained in:
Trevor Slocum 2020-09-23 16:21:11 -07:00
parent 89fa23ab00
commit 97f450fc34
1 changed files with 3 additions and 0 deletions

View File

@ -661,6 +661,9 @@ func (d *DropDown) Draw(screen tcell.Screen) {
if d.list.scrollBarVisibility == ScrollBarAlways || (d.list.scrollBarVisibility == ScrollBarAuto && len(d.options) > lheight) {
lwidth++ // Add space for scroll bar
}
if lwidth < fieldWidth {
lwidth = fieldWidth
}
d.list.SetRect(lx, ly, lwidth, lheight)
d.list.Draw(screen)
}