mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Can: - move between todo items - toggle checked/unchecked state Cannot: - persiste changes to file - add items - delete items
32 lines
546 B
Go
32 lines
546 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 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)
|
|
}
|