From 2067a7307290567d693551689c2a5ab93d1ba52a Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Sat, 11 May 2019 08:41:00 -0700 Subject: [PATCH] Fix a bug in scrollable.RowColor --- modules/hackernews/widget.go | 5 +++-- wtf/scrollable.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/hackernews/widget.go b/modules/hackernews/widget.go index 44a15328..9131f88d 100644 --- a/modules/hackernews/widget.go +++ b/modules/hackernews/widget.go @@ -97,13 +97,14 @@ func (widget *Widget) Render() { func (widget *Widget) contentFrom(stories []Story) string { var str string for idx, story := range stories { + u, _ := url.Parse(story.URL) + str = str + fmt.Sprintf( - `["%d"][""][%s] [yellow]%d. [%s]%s [blue](%s)[""]`, + `["%d"][""][%s]%2d. %s [lightblue](%s)[white][""]`, idx, widget.RowColor(idx), idx+1, - widget.RowColor(idx), story.Title, strings.TrimPrefix(u.Host, "www."), ) diff --git a/wtf/scrollable.go b/wtf/scrollable.go index a81e0277..fe716a32 100644 --- a/wtf/scrollable.go +++ b/wtf/scrollable.go @@ -41,7 +41,7 @@ func (widget *ScrollableWidget) GetSelected() int { func (widget *ScrollableWidget) RowColor(idx int) string { if widget.View.HasFocus() && (idx == widget.selected) { - widget.CommonSettings.DefaultFocussedRowColor() + return widget.CommonSettings.DefaultFocussedRowColor() } return widget.CommonSettings.RowColor(idx)