1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00
wtf/todo/display.go
2018-04-22 22:05:26 -07:00

36 lines
593 B
Go

package todo
import (
"fmt"
)
func (widget *Widget) display() {
widget.View.Clear()
title := fmt.Sprintf(" 📝 %s ", widget.FilePath)
widget.View.SetTitle(title)
str := ""
for idx, item := range widget.list.Items {
foreColor, backColor := "white", "black"
if item.Checked {
foreColor = "gray"
}
if widget.View.HasFocus() && idx == widget.list.selected {
foreColor, backColor = "black", "olive"
}
str = str + fmt.Sprintf(
"[%s:%s]|%s| %s[white]\n",
foreColor,
backColor,
item.CheckMark(),
item.Text,
)
}
fmt.Fprintf(widget.View, "%s", str)
}