mirror of
https://github.com/charmbracelet/glow
synced 2024-12-14 22:22:26 +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)
|
localItems := m.countMarkdowns(localMarkdown)
|
||||||
stashedItems := m.countMarkdowns(stashedMarkdown) + m.countMarkdowns(convertedMarkdown)
|
stashedItems := m.countMarkdowns(stashedMarkdown) + m.countMarkdowns(convertedMarkdown)
|
||||||
|
newsItems := m.countMarkdowns(newsMarkdown)
|
||||||
|
|
||||||
// Loading's finished and all we have is news.
|
// 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() {
|
if m.stashedOnly() {
|
||||||
return common.Subtle("No stashed markdown files found.") + maybeOffline
|
return common.Subtle("No stashed markdown files found.") + maybeOffline
|
||||||
} else {
|
} else {
|
||||||
|
@ -874,6 +875,18 @@ func stashHeaderView(m stashModel) string {
|
||||||
si := common.Subtle(fmt.Sprintf("%d Stashed", stashedItems))
|
si := common.Subtle(fmt.Sprintf("%d Stashed", stashedItems))
|
||||||
s += fmt.Sprintf("%s%s", divider, si)
|
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
|
return common.Subtle(s) + maybeOffline
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue