mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Fix a bug in scrollable.RowColor
This commit is contained in:
parent
78fc097818
commit
2067a73072
@ -97,13 +97,14 @@ func (widget *Widget) Render() {
|
|||||||
func (widget *Widget) contentFrom(stories []Story) string {
|
func (widget *Widget) contentFrom(stories []Story) string {
|
||||||
var str string
|
var str string
|
||||||
for idx, story := range stories {
|
for idx, story := range stories {
|
||||||
|
|
||||||
u, _ := url.Parse(story.URL)
|
u, _ := url.Parse(story.URL)
|
||||||
|
|
||||||
str = str + fmt.Sprintf(
|
str = str + fmt.Sprintf(
|
||||||
`["%d"][""][%s] [yellow]%d. [%s]%s [blue](%s)[""]`,
|
`["%d"][""][%s]%2d. %s [lightblue](%s)[white][""]`,
|
||||||
idx,
|
idx,
|
||||||
widget.RowColor(idx),
|
widget.RowColor(idx),
|
||||||
idx+1,
|
idx+1,
|
||||||
widget.RowColor(idx),
|
|
||||||
story.Title,
|
story.Title,
|
||||||
strings.TrimPrefix(u.Host, "www."),
|
strings.TrimPrefix(u.Host, "www."),
|
||||||
)
|
)
|
||||||
|
@ -41,7 +41,7 @@ func (widget *ScrollableWidget) GetSelected() int {
|
|||||||
|
|
||||||
func (widget *ScrollableWidget) RowColor(idx int) string {
|
func (widget *ScrollableWidget) RowColor(idx int) string {
|
||||||
if widget.View.HasFocus() && (idx == widget.selected) {
|
if widget.View.HasFocus() && (idx == widget.selected) {
|
||||||
widget.CommonSettings.DefaultFocussedRowColor()
|
return widget.CommonSettings.DefaultFocussedRowColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
return widget.CommonSettings.RowColor(idx)
|
return widget.CommonSettings.RowColor(idx)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user