moson-mo 1 month ago committed by GitHub
commit 0ce6a413a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -253,6 +253,7 @@ func (i *InputField) SetAutocompleteStyles(background tcell.Color, main, selecte
// SetFormAttributes sets attributes shared by all form items.
func (i *InputField) SetFormAttributes(labelWidth int, labelColor, bgColor, fieldTextColor, fieldBgColor tcell.Color) FormItem {
i.backgroundColor = bgColor
i.textArea.SetFormAttributes(labelWidth, labelColor, bgColor, fieldTextColor, fieldBgColor)
return i
}
@ -464,8 +465,9 @@ func (i *InputField) Draw(screen tcell.Screen) {
labelWidth = TaggedStringWidth(i.textArea.GetLabel())
}
fieldWidth := i.fieldWidth
if fieldWidth == 0 {
fieldWidth = width - labelWidth
maxWidth := width - labelWidth
if fieldWidth == 0 || fieldWidth > maxWidth {
fieldWidth = maxWidth
}
i.textArea.SetRect(x, y, labelWidth+fieldWidth, 1)
i.textArea.setMinCursorPadding(fieldWidth-1, 1)

Loading…
Cancel
Save