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:
parent
13780f0ece
commit
1be970eaec
@ -56,7 +56,7 @@ func (widget *Widget) display() {
|
|||||||
widget.View.SetWrap(false)
|
widget.View.SetWrap(false)
|
||||||
widget.View.SetTitle(
|
widget.View.SetTitle(
|
||||||
fmt.Sprintf(
|
fmt.Sprintf(
|
||||||
"%s- [green]%s[white]",
|
"%s- [green]%s[white] ",
|
||||||
widget.Name,
|
widget.Name,
|
||||||
wtf.Config.UString("wtf.mods.jira.project"),
|
wtf.Config.UString("wtf.mods.jira.project"),
|
||||||
),
|
),
|
||||||
@ -95,7 +95,8 @@ func (widget *Widget) contentFrom(searchResult *SearchResult) string {
|
|||||||
|
|
||||||
for idx, issue := range searchResult.Issues {
|
for idx, issue := range searchResult.Issues {
|
||||||
str = str + fmt.Sprintf(
|
str = str + fmt.Sprintf(
|
||||||
" [%s]%-6s[white] [green]%-10s [%s]%s\n",
|
"[%s] [%s]%-6s[white] [green]%-10s[white] [%s]%s\n",
|
||||||
|
widget.rowColor(idx),
|
||||||
widget.issueTypeColor(&issue),
|
widget.issueTypeColor(&issue),
|
||||||
issue.IssueFields.IssueType.Name,
|
issue.IssueFields.IssueType.Name,
|
||||||
issue.Key,
|
issue.Key,
|
||||||
@ -109,8 +110,9 @@ func (widget *Widget) contentFrom(searchResult *SearchResult) string {
|
|||||||
|
|
||||||
func (widget *Widget) rowColor(idx int) string {
|
func (widget *Widget) rowColor(idx int) string {
|
||||||
if widget.View.HasFocus() && (idx == widget.selected) {
|
if widget.View.HasFocus() && (idx == widget.selected) {
|
||||||
foreColor := wtf.Config.UString("wtf.mods.jira.colors.highlight.fore", "black")
|
foreColor := wtf.Config.UString("wtf.colors.highlight.fore", "black")
|
||||||
backColor := wtf.Config.UString("wtf.mods.jira.colors.highlight.back", "white")
|
backColor := wtf.Config.UString("wtf.colors.highlight.back", "orange")
|
||||||
|
|
||||||
return fmt.Sprintf("%s:%s", foreColor, backColor)
|
return fmt.Sprintf("%s:%s", foreColor, backColor)
|
||||||
}
|
}
|
||||||
return wtf.RowColor("jira", idx)
|
return wtf.RowColor("jira", idx)
|
||||||
|
@ -50,5 +50,10 @@ func (widget *Widget) formattedItemLine(item *wtf.ChecklistItem, selectedItem *w
|
|||||||
tview.Escape(item.Text),
|
tview.Escape(item.Text),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
_, _, w, _ := widget.View.GetInnerRect()
|
||||||
|
if w > maxLen {
|
||||||
|
maxLen = w
|
||||||
|
}
|
||||||
|
|
||||||
return str + wtf.PadRow((checkWidth+len(item.Text)), (checkWidth+maxLen+1)) + "\n"
|
return str + wtf.PadRow((checkWidth+len(item.Text)), (checkWidth+maxLen+1)) + "\n"
|
||||||
}
|
}
|
||||||
|
@ -9,15 +9,15 @@ import (
|
|||||||
|
|
||||||
const checkWidth = 4
|
const checkWidth = 4
|
||||||
|
|
||||||
func (w *Widget) display() {
|
func (widget *Widget) display() {
|
||||||
proj := w.CurrentProject()
|
proj := widget.CurrentProject()
|
||||||
|
|
||||||
if proj == nil {
|
if proj == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
w.View.SetTitle(fmt.Sprintf("%s- [green]%s[white] ", w.Name, proj.Project.Name))
|
widget.View.SetTitle(fmt.Sprintf("%s- [green]%s[white] ", widget.Name, proj.Project.Name))
|
||||||
str := wtf.SigilStr(len(w.projects), w.idx, w.View) + "\n"
|
str := wtf.SigilStr(len(widget.projects), widget.idx, widget.View) + "\n"
|
||||||
|
|
||||||
maxLen := proj.LongestLine()
|
maxLen := proj.LongestLine()
|
||||||
|
|
||||||
@ -36,9 +36,14 @@ func (w *Widget) display() {
|
|||||||
tview.Escape(item.Content),
|
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"
|
str = str + row + wtf.PadRow((checkWidth+len(item.Content)), (checkWidth+maxLen+1)) + "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
w.View.Clear()
|
//widget.View.Clear()
|
||||||
w.View.SetText(str)
|
widget.View.SetText(str)
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ type Project struct {
|
|||||||
todoist.Project
|
todoist.Project
|
||||||
|
|
||||||
index int
|
index int
|
||||||
list wtf.Checklist
|
|
||||||
tasks []todoist.Task
|
tasks []todoist.Task
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,7 +23,6 @@ func NewProject(id int) *Project {
|
|||||||
Project: project,
|
Project: project,
|
||||||
|
|
||||||
index: -1,
|
index: -1,
|
||||||
list: wtf.NewChecklist(),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
proj.loadTasks()
|
proj.loadTasks()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user