1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00
wtf/modules/todoist/display.go
2019-08-05 10:50:12 -07:00

33 lines
566 B
Go

package todoist
import (
"fmt"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/utils"
)
func (widget *Widget) display() {
proj := widget.CurrentProject()
if proj == nil {
return
}
title := fmt.Sprintf("[green]%s[white]", proj.Project.Name)
str := ""
for idx, item := range proj.tasks {
row := fmt.Sprintf(
`[%s]| | %s[%s]`,
widget.RowColor(idx),
tview.Escape(item.Content),
widget.RowColor(idx),
)
str += utils.HighlightableHelper(widget.View, row, idx, len(item.Content))
}
widget.ScrollableWidget.Redraw(title, str, false)
}