mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Add a helper function to do highlighting in a uniform way
This commit is contained in:
@@ -83,16 +83,15 @@ func (widget *Widget) contentFrom(stories []Story) string {
|
||||
|
||||
u, _ := url.Parse(story.URL)
|
||||
|
||||
str += fmt.Sprintf(
|
||||
`["%d"][""][%s]%2d. %s [lightblue](%s)[white][""]`,
|
||||
idx,
|
||||
row := fmt.Sprintf(
|
||||
`[%s]%2d. %s [lightblue](%s)[white]`,
|
||||
widget.RowColor(idx),
|
||||
idx+1,
|
||||
story.Title,
|
||||
strings.TrimPrefix(u.Host, "www."),
|
||||
)
|
||||
|
||||
str += "\n"
|
||||
str += wtf.HighlightableHelper(widget.View, row, idx, len(story.Title))
|
||||
}
|
||||
|
||||
return str
|
||||
|
||||
Reference in New Issue
Block a user