[#1223] lens/tui: Add rich text support for multipage view component
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
This commit is contained in:
parent
cd282edfd5
commit
8682762ef1
1 changed files with 6 additions and 14 deletions
|
@ -141,22 +141,14 @@ func (v *MultipageView) draw(screen tcell.Screen) {
|
|||
}
|
||||
|
||||
v.DrawForSubclass(screen, v)
|
||||
deltaY := 0
|
||||
for index := v.firstItemIndex; index < v.lastItemIndex; index++ {
|
||||
deltaX := 0
|
||||
for i, char := range v.items[index].Text {
|
||||
if i == width {
|
||||
break
|
||||
}
|
||||
|
||||
if index == v.selectedItemIndex {
|
||||
screen.SetContent(x+deltaX, y+deltaY, char, nil, v.selectedTextStyle)
|
||||
} else {
|
||||
screen.SetContent(x+deltaX, y+deltaY, char, nil, v.mainTextStyle)
|
||||
}
|
||||
deltaX++
|
||||
text := v.items[index].Text
|
||||
if index == v.selectedItemIndex {
|
||||
text = fmt.Sprintf("[:white]%s[:black]", text)
|
||||
}
|
||||
deltaY++
|
||||
tview.Print(screen, text, x, y, width, tview.AlignLeft, tcell.ColorWhite)
|
||||
|
||||
y++
|
||||
}
|
||||
v.SetTitle(title)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue