1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

WTF-400 Partial conversion to new Common settings

This commit is contained in:
Chris Cummer
2019-04-18 19:02:08 -07:00
parent f09d08bda2
commit 59f0bc6cfc
8 changed files with 89 additions and 49 deletions

View File

@@ -13,7 +13,10 @@ const checkWidth = 4
func (widget *Widget) display() {
str := ""
newList := checklist.NewChecklist()
newList := checklist.NewChecklist(
widget.settings.common.Sigils.CheckedIcon,
widget.settings.common.Sigils.UncheckedIcon,
)
offset := 0
@@ -33,19 +36,19 @@ func (widget *Widget) display() {
widget.View.Clear()
widget.View.SetText(str)
widget.View.Highlight(strconv.Itoa(widget.list.Selected)).ScrollToHighlight()
widget.View.Highlight(strconv.Itoa(widget.list.Selected())).ScrollToHighlight()
}
func (widget *Widget) formattedItemLine(idx int, item *checklist.ChecklistItem, selectedItem *checklist.ChecklistItem, maxLen int) string {
foreColor, backColor := "white", wtf.Config.UString("wtf.colors.background", "black")
foreColor, backColor := widget.settings.common.Colors.Text, widget.settings.common.Colors.Background
if item.Checked {
foreColor = wtf.Config.UString("wtf.colors.checked", "white")
foreColor = widget.settings.common.Colors.Checked
}
if widget.View.HasFocus() && (item == selectedItem) {
foreColor = wtf.Config.UString("wtf.colors.highlight.fore", "black")
backColor = wtf.Config.UString("wtf.colors.highlight.back", "orange")
foreColor = widget.settings.common.Colors.HighlightFore
backColor = widget.settings.common.Colors.HighlightBack
}
str := fmt.Sprintf(

View File

@@ -54,7 +54,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
app: app,
settings: settings,
filePath: settings.filePath,
list: checklist.NewChecklist(),
list: checklist.NewChecklist(settings.common.Sigils.CheckedIcon, settings.common.Sigils.UncheckedIcon),
pages: pages,
}