1
0
mirror of https://github.com/rivo/tview.git synced 2025-04-26 13:49:06 +08:00

Fix unselected list color

This commit is contained in:
eeeXun 2024-05-27 23:18:55 +08:00
parent 037df494fb
commit 95779c15c5

View File

@ -506,12 +506,16 @@ func (l *List) Draw(screen tcell.Screen) {
}
// Main text.
var printedWidth int
var style tcell.Style
selected := index == l.currentItem && (!l.selectedFocusOnly || l.HasFocus())
style := l.mainTextStyle
if selected {
style = l.selectedStyle
_, _, printedWidth = printWithStyle(screen, item.MainText, x, y, l.horizontalOffset, width, AlignLeft, style, false)
} else {
style = l.mainTextStyle
_, _, printedWidth = printWithStyle(screen, item.MainText, x, y, l.horizontalOffset, width, AlignLeft, style, true)
}
_, _, printedWidth := printWithStyle(screen, item.MainText, x, y, l.horizontalOffset, width, AlignLeft, style, false)
if printedWidth > maxWidth {
maxWidth = printedWidth
}