fix(dropdown): Use `getFieldWidth` during draw

This commit is contained in:
Andreas Bieber 2020-09-17 12:55:38 +02:00
parent dedc2da113
commit 6fa4370332
1 changed files with 4 additions and 1 deletions

View File

@ -382,7 +382,10 @@ func (d *DropDown) SetFieldWidth(width int) *DropDown {
func (d *DropDown) GetFieldWidth() int {
d.RLock()
defer d.RUnlock()
return d.getFieldWidth()
}
func (d *DropDown) getFieldWidth() int {
if d.fieldWidth > 0 {
return d.fieldWidth
}
@ -537,7 +540,7 @@ func (d *DropDown) Draw(screen tcell.Screen) {
}
// Draw selection area.
fieldWidth := d.fieldWidth
fieldWidth := d.getFieldWidth()
if fieldWidth == 0 {
fieldWidth = maxWidth
if d.currentOption < 0 {