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

List highlights span entire widget width

This commit is contained in:
Chris Cummer
2018-07-18 10:06:28 -07:00
parent 13780f0ece
commit 1be970eaec
4 changed files with 22 additions and 12 deletions

View File

@@ -9,15 +9,15 @@ import (
const checkWidth = 4
func (w *Widget) display() {
proj := w.CurrentProject()
func (widget *Widget) display() {
proj := widget.CurrentProject()
if proj == nil {
return
}
w.View.SetTitle(fmt.Sprintf("%s- [green]%s[white] ", w.Name, proj.Project.Name))
str := wtf.SigilStr(len(w.projects), w.idx, w.View) + "\n"
widget.View.SetTitle(fmt.Sprintf("%s- [green]%s[white] ", widget.Name, proj.Project.Name))
str := wtf.SigilStr(len(widget.projects), widget.idx, widget.View) + "\n"
maxLen := proj.LongestLine()
@@ -36,9 +36,14 @@ func (w *Widget) display() {
tview.Escape(item.Content),
)
_, _, w, _ := widget.View.GetInnerRect()
if w > maxLen {
maxLen = w
}
str = str + row + wtf.PadRow((checkWidth+len(item.Content)), (checkWidth+maxLen+1)) + "\n"
}
w.View.Clear()
w.View.SetText(str)
//widget.View.Clear()
widget.View.SetText(str)
}

View File

@@ -10,7 +10,6 @@ type Project struct {
todoist.Project
index int
list wtf.Checklist
tasks []todoist.Task
}
@@ -24,7 +23,6 @@ func NewProject(id int) *Project {
Project: project,
index: -1,
list: wtf.NewChecklist(),
}
proj.loadTasks()