mirror of
https://github.com/charmbracelet/glow
synced 2024-11-10 06:04:18 +00:00
Display news item count in stash view
This commit is contained in:
parent
7fb4a43474
commit
4782b99154
1 changed files with 14 additions and 1 deletions
15
ui/stash.go
15
ui/stash.go
|
@ -851,9 +851,10 @@ func stashHeaderView(m stashModel) string {
|
|||
|
||||
localItems := m.countMarkdowns(localMarkdown)
|
||||
stashedItems := m.countMarkdowns(stashedMarkdown) + m.countMarkdowns(convertedMarkdown)
|
||||
newsItems := m.countMarkdowns(newsMarkdown)
|
||||
|
||||
// Loading's finished and all we have is news.
|
||||
if !loading && localItems == 0 && stashedItems == 0 {
|
||||
if !loading && localItems == 0 && stashedItems == 0 && newsItems == 0 {
|
||||
if m.stashedOnly() {
|
||||
return common.Subtle("No stashed markdown files found.") + maybeOffline
|
||||
} else {
|
||||
|
@ -874,6 +875,18 @@ func stashHeaderView(m stashModel) string {
|
|||
si := common.Subtle(fmt.Sprintf("%d Stashed", stashedItems))
|
||||
s += fmt.Sprintf("%s%s", divider, si)
|
||||
}
|
||||
if newsItems > 0 {
|
||||
var divider string
|
||||
if localItems > 0 || stashedItems > 0 {
|
||||
divider = dividerDot
|
||||
}
|
||||
si := common.Subtle(fmt.Sprintf("%d News", newsItems))
|
||||
if newsItems == 1 {
|
||||
si = common.Subtle(fmt.Sprintf("%d New", newsItems))
|
||||
}
|
||||
|
||||
s += fmt.Sprintf("%s%s", divider, si)
|
||||
}
|
||||
return common.Subtle(s) + maybeOffline
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue