From 56847c1b01ac10a8d00fb85f12537f1abd1ca1f2 Mon Sep 17 00:00:00 2001 From: Nicolas Martin Date: Mon, 26 Oct 2020 15:52:54 +0100 Subject: [PATCH] Dim search results during filtering --- ui/stash.go | 5 ++++- ui/stashitem.go | 21 ++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ui/stash.go b/ui/stash.go index 6ebcdbe..218b6b2 100644 --- a/ui/stash.go +++ b/ui/stash.go @@ -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) } diff --git a/ui/stashitem.go b/ui/stashitem.go index 6153c39..fdb95a9 100644 --- a/ui/stashitem.go +++ b/ui/stashitem.go @@ -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)