mirror of
https://github.com/charmbracelet/glow
synced 2025-01-07 09:38:50 +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 ")
|
logoOrSearch := glowLogoView(" Glow ")
|
||||||
// we replace the logo with the search field in
|
// 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)
|
logoOrSearch = textinput.View(m.searchInput)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,14 @@ func stashItemView(b *strings.Builder, m stashModel, index int, md *markdown) {
|
||||||
icon = ""
|
icon = ""
|
||||||
title = textinput.View(m.noteInput)
|
title = textinput.View(m.noteInput)
|
||||||
date = dullYellowFg(date)
|
date = dullYellowFg(date)
|
||||||
|
case stashStateSearchNotes:
|
||||||
|
if len(m.getNotes()) != 1 {
|
||||||
|
gutter = dullFuchsiaFg(verticalLine)
|
||||||
|
icon = dullFuchsiaFg(icon)
|
||||||
|
title = dullFuchsiaFg(title)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
fallthrough
|
||||||
default:
|
default:
|
||||||
// Selected
|
// Selected
|
||||||
gutter = dullFuchsiaFg(verticalLine)
|
gutter = dullFuchsiaFg(verticalLine)
|
||||||
|
@ -80,7 +88,11 @@ func stashItemView(b *strings.Builder, m stashModel, index int, md *markdown) {
|
||||||
// Normal
|
// Normal
|
||||||
if md.markdownType == newsMarkdown {
|
if md.markdownType == newsMarkdown {
|
||||||
gutter = " "
|
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)
|
date = subtleIndigoFg(date)
|
||||||
} else {
|
} else {
|
||||||
icon = greenFg(icon)
|
icon = greenFg(icon)
|
||||||
|
@ -90,6 +102,13 @@ func stashItemView(b *strings.Builder, m stashModel, index int, md *markdown) {
|
||||||
gutter = " "
|
gutter = " "
|
||||||
date = warmGrayFg(date)
|
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)
|
fmt.Fprintf(b, "%s %s%s\n", gutter, icon, title)
|
||||||
|
|
Loading…
Reference in a new issue