mirror of
https://github.com/rivo/tview.git
synced 2025-04-24 13:48:56 +08:00
Merge b4533bdcc92792b24b74b0a47d4ee6762db0712a into c76f7879f592d17e9e68a1d795a85faae6cb7414
This commit is contained in:
commit
00650522e9
@ -268,6 +268,7 @@ func (i *InputField) SetAutocompleteUseTags(useTags bool) *InputField {
|
||||
|
||||
// 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
|
||||
}
|
||||
@ -480,8 +481,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…
x
Reference in New Issue
Block a user