From 6fa43703321cc74d1a2e80804f472364214091e6 Mon Sep 17 00:00:00 2001 From: Andreas Bieber Date: Thu, 17 Sep 2020 12:55:38 +0200 Subject: [PATCH] fix(dropdown): Use `getFieldWidth` during draw --- dropdown.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dropdown.go b/dropdown.go index 2bf990b..f6f61e1 100644 --- a/dropdown.go +++ b/dropdown.go @@ -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 {