mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Make Jira widget scrollable
Adds ability to scroll through the list of issues when they don't fit into the view
This commit is contained in:
parent
1c413c60d8
commit
dccf04a27a
@ -6,6 +6,7 @@ import (
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/senorprogrammer/wtf/wtf"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
const HelpText = `
|
||||
@ -38,6 +39,8 @@ func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
|
||||
widget.HelpfulWidget.SetView(widget.View)
|
||||
widget.unselect()
|
||||
|
||||
widget.View.SetScrollable(true)
|
||||
widget.View.SetRegions(true)
|
||||
widget.View.SetInputCapture(widget.keyboardIntercept)
|
||||
return &widget
|
||||
}
|
||||
@ -75,8 +78,10 @@ func (widget *Widget) display() {
|
||||
|
||||
str := fmt.Sprintf("%s- [green]%s[white]", widget.Name, wtf.Config.UString("wtf.mods.jira.project"))
|
||||
|
||||
widget.View.Clear()
|
||||
widget.View.SetTitle(widget.ContextualTitle(str))
|
||||
widget.View.SetText(fmt.Sprintf("%s", widget.contentFrom(widget.result)))
|
||||
widget.View.Highlight(strconv.Itoa(widget.selected)).ScrollToHighlight()
|
||||
}
|
||||
|
||||
func (widget *Widget) next() {
|
||||
@ -110,7 +115,8 @@ func (widget *Widget) contentFrom(searchResult *SearchResult) string {
|
||||
|
||||
for idx, issue := range searchResult.Issues {
|
||||
fmtStr := fmt.Sprintf(
|
||||
"[%s] [%s]%-6s[white] [green]%-10s[white] [%s]%s",
|
||||
`["%d"][""][%s] [%s]%-6s[white] [green]%-10s[white] [%s]%s`,
|
||||
idx,
|
||||
widget.rowColor(idx),
|
||||
widget.issueTypeColor(&issue),
|
||||
issue.IssueFields.IssueType.Name,
|
||||
|
Loading…
x
Reference in New Issue
Block a user