mirror of
https://github.com/charmbracelet/glow
synced 2024-11-10 06:04:18 +00:00
Dim search results during filtering
This commit is contained in:
parent
4782b99154
commit
56847c1b01
2 changed files with 24 additions and 2 deletions
|
@ -785,7 +785,10 @@ func stashView(m stashModel) string {
|
|||
|
||||
logoOrSearch := glowLogoView(" Glow ")
|
||||
// we replace the logo with the search field in
|
||||
if m.state == stashStateSearchNotes || m.state == stashStateShowFiltered {
|
||||
if m.state == stashStateSearchNotes {
|
||||
logoOrSearch = textinput.View(m.searchInput)
|
||||
} else if m.state == stashStateShowFiltered {
|
||||
m.searchInput.TextColor = m.searchInput.PlaceholderColor
|
||||
logoOrSearch = textinput.View(m.searchInput)
|
||||
}
|
||||
|
||||
|
|
|
@ -69,6 +69,14 @@ func stashItemView(b *strings.Builder, m stashModel, index int, md *markdown) {
|
|||
icon = ""
|
||||
title = textinput.View(m.noteInput)
|
||||
date = dullYellowFg(date)
|
||||
case stashStateSearchNotes:
|
||||
if len(m.getNotes()) != 1 {
|
||||
gutter = dullFuchsiaFg(verticalLine)
|
||||
icon = dullFuchsiaFg(icon)
|
||||
title = dullFuchsiaFg(title)
|
||||
break
|
||||
}
|
||||
fallthrough
|
||||
default:
|
||||
// Selected
|
||||
gutter = dullFuchsiaFg(verticalLine)
|
||||
|
@ -80,7 +88,11 @@ func stashItemView(b *strings.Builder, m stashModel, index int, md *markdown) {
|
|||
// Normal
|
||||
if md.markdownType == newsMarkdown {
|
||||
gutter = " "
|
||||
title = te.String(title).Foreground(common.Indigo.Color()).String()
|
||||
if m.state == stashStateSearchNotes {
|
||||
title = subtleIndigoFg(title)
|
||||
} else {
|
||||
title = te.String(title).Foreground(common.Indigo.Color()).String()
|
||||
}
|
||||
date = subtleIndigoFg(date)
|
||||
} else {
|
||||
icon = greenFg(icon)
|
||||
|
@ -90,6 +102,13 @@ func stashItemView(b *strings.Builder, m stashModel, index int, md *markdown) {
|
|||
gutter = " "
|
||||
date = warmGrayFg(date)
|
||||
}
|
||||
|
||||
if m.state == stashStateSearchNotes {
|
||||
icon = common.Subtle(icon)
|
||||
title = common.Subtle(title)
|
||||
gutter = common.Subtle(gutter)
|
||||
date = common.Subtle(date)
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Fprintf(b, "%s %s%s\n", gutter, icon, title)
|
||||
|
|
Loading…
Reference in a new issue