diff --git a/internal/backend/backend.go b/internal/backend/backend.go index 8c3a48b..9dac106 100644 --- a/internal/backend/backend.go +++ b/internal/backend/backend.go @@ -158,7 +158,7 @@ func (b Backend) articlesToSuccessMsg(items cache.SortableArticles) FetchArticle result[i] = ArticleItem{ ArtTitle: item.Title, - Desc: betterDesc(item.Description), + RawDesc: betterDesc(item.Description), MarkdownContent: rss.YassifyItem(&items[i]), FeedURL: item.Link, } diff --git a/internal/backend/message.go b/internal/backend/message.go index 4ad6698..cce56a8 100644 --- a/internal/backend/message.go +++ b/internal/backend/message.go @@ -11,6 +11,7 @@ type ArticleItem struct { list.Item ArtTitle string Desc string + RawDesc string MarkdownContent string FeedURL string } diff --git a/internal/ui/tab/feed/feed.go b/internal/ui/tab/feed/feed.go index 7d19e60..ad2b95f 100644 --- a/internal/ui/tab/feed/feed.go +++ b/internal/ui/tab/feed/feed.go @@ -89,6 +89,15 @@ func (m Model) SetSize(width, height int) tab.Tab { m.width = width m.height = height newTab, _ := m.updateViewport() + + // Re-Wrap the descs + items := m.list.Items() + for i := range items { + item := items[i].(backend.ArticleItem) + item.Desc = wrap.String(item.RawDesc, m.style.listWidth-4) + items[i] = item + } + return newTab } @@ -241,7 +250,7 @@ func (m Model) loadTab(items []list.Item) tab.Tab { // Wrap the descs, it's better to do it upfront then to rely on the list pagination for i := range items { item := items[i].(backend.ArticleItem) - item.Desc = wrap.String(item.Desc, m.style.listWidth-4) + item.Desc = wrap.String(item.RawDesc, m.style.listWidth-4) items[i] = item }