mirror of
https://github.com/charmbracelet/glow
synced 2024-12-13 21:52:37 +00:00
Also highlight filtered characters on selected filter results
This commit is contained in:
parent
58eca2414a
commit
6cf1152f87
1 changed files with 5 additions and 5 deletions
|
@ -44,14 +44,14 @@ func stashItemView(b *strings.Builder, m stashModel, index int, md *markdown) {
|
||||||
}
|
}
|
||||||
|
|
||||||
isSelected := index == m.index
|
isSelected := index == m.index
|
||||||
notFilteringNotes := m.state != stashStateFilterNotes
|
isFilteringNotes := m.state == stashStateFilterNotes
|
||||||
|
|
||||||
// If there are multiple items being filtered we don't highlight a selected
|
// If there are multiple items being filtered we don't highlight a selected
|
||||||
// item in the results. If we've filtered down to one item, however,
|
// item in the results. If we've filtered down to one item, however,
|
||||||
// highlight that first item since pressing return will open it.
|
// highlight that first item since pressing return will open it.
|
||||||
singleFilteredItem := m.state == stashStateFilterNotes && len(m.getNotes()) == 1
|
singleFilteredItem := m.state == stashStateFilterNotes && len(m.getNotes()) == 1
|
||||||
|
|
||||||
if isSelected && notFilteringNotes || singleFilteredItem {
|
if isSelected && !isFilteringNotes || singleFilteredItem {
|
||||||
// Selected item
|
// Selected item
|
||||||
|
|
||||||
switch m.state {
|
switch m.state {
|
||||||
|
@ -68,7 +68,7 @@ func stashItemView(b *strings.Builder, m stashModel, index int, md *markdown) {
|
||||||
default:
|
default:
|
||||||
gutter = dullFuchsiaFg(verticalLine)
|
gutter = dullFuchsiaFg(verticalLine)
|
||||||
icon = dullFuchsiaFg(icon)
|
icon = dullFuchsiaFg(icon)
|
||||||
if singleFilteredItem {
|
if m.state == stashStateShowFiltered || singleFilteredItem {
|
||||||
s := termenv.Style{}.Foreground(common.Fuschia.Color())
|
s := termenv.Style{}.Foreground(common.Fuschia.Color())
|
||||||
title = styleFilteredText(title, m.filterInput.Value(), s, s.Underline())
|
title = styleFilteredText(title, m.filterInput.Value(), s, s.Underline())
|
||||||
} else {
|
} else {
|
||||||
|
@ -82,7 +82,7 @@ func stashItemView(b *strings.Builder, m stashModel, index int, md *markdown) {
|
||||||
if md.markdownType == newsMarkdown {
|
if md.markdownType == newsMarkdown {
|
||||||
gutter = " "
|
gutter = " "
|
||||||
|
|
||||||
if m.state == stashStateFilterNotes && m.filterInput.Value() == "" {
|
if isFilteringNotes && m.filterInput.Value() == "" {
|
||||||
title = dimIndigoFg(title)
|
title = dimIndigoFg(title)
|
||||||
date = dimSubtleIndigoFg(date)
|
date = dimSubtleIndigoFg(date)
|
||||||
} else {
|
} else {
|
||||||
|
@ -90,7 +90,7 @@ func stashItemView(b *strings.Builder, m stashModel, index int, md *markdown) {
|
||||||
title = styleFilteredText(title, m.filterInput.Value(), s, s.Underline())
|
title = styleFilteredText(title, m.filterInput.Value(), s, s.Underline())
|
||||||
date = subtleIndigoFg(date)
|
date = subtleIndigoFg(date)
|
||||||
}
|
}
|
||||||
} else if m.state == stashStateFilterNotes && m.filterInput.Value() == "" {
|
} else if isFilteringNotes && m.filterInput.Value() == "" {
|
||||||
icon = dimGreenFg(icon)
|
icon = dimGreenFg(icon)
|
||||||
if title == noMemoTitle {
|
if title == noMemoTitle {
|
||||||
title = dimWarmGrayFg(title)
|
title = dimWarmGrayFg(title)
|
||||||
|
|
Loading…
Reference in a new issue