mirror of
https://github.com/charmbracelet/glow
synced 2024-11-10 06:04:18 +00:00
Highlight the most recent stash item in green in the stash view
...as long as the statusMessage is `Stashed!` is present
This commit is contained in:
parent
a0fb0e4cd0
commit
8f3c5df236
2 changed files with 26 additions and 8 deletions
|
@ -68,20 +68,34 @@ func stashItemView(b *strings.Builder, m stashModel, index int, md *markdown) {
|
|||
title = m.noteInput.View()
|
||||
date = dullYellowFg(date)
|
||||
default:
|
||||
gutter = dullFuchsiaFg(verticalLine)
|
||||
icon = dullFuchsiaFg(icon)
|
||||
if m.currentSection().key == filterSection && m.filterState == filterApplied || singleFilteredItem {
|
||||
s := termenv.Style{}.Foreground(lib.Fuschia.Color())
|
||||
title = styleFilteredText(title, m.filterInput.Value(), s, s.Underline())
|
||||
if m.common.latestFileStashed == md.stashID &&
|
||||
m.statusMessage == stashedStatusMessage {
|
||||
gutter = greenFg(verticalLine)
|
||||
icon = dimGreenFg(icon)
|
||||
title = greenFg(title)
|
||||
date = dimGreenFg(date)
|
||||
} else {
|
||||
title = fuchsiaFg(title)
|
||||
gutter = dullFuchsiaFg(verticalLine)
|
||||
icon = dullFuchsiaFg(icon)
|
||||
if m.currentSection().key == filterSection && m.filterState == filterApplied || singleFilteredItem {
|
||||
s := termenv.Style{}.Foreground(lib.Fuschia.Color())
|
||||
title = styleFilteredText(title, m.filterInput.Value(), s, s.Underline())
|
||||
} else {
|
||||
title = fuchsiaFg(title)
|
||||
}
|
||||
date = dullFuchsiaFg(date)
|
||||
}
|
||||
date = dullFuchsiaFg(date)
|
||||
}
|
||||
} else {
|
||||
// Regular (non-selected) items
|
||||
|
||||
if md.docType == NewsDoc {
|
||||
if m.common.latestFileStashed == md.stashID &&
|
||||
m.statusMessage == stashedStatusMessage {
|
||||
gutter = " "
|
||||
icon = dimGreenFg(icon)
|
||||
title = greenFg(title)
|
||||
date = dimGreenFg(date)
|
||||
} else if md.docType == NewsDoc {
|
||||
gutter = " "
|
||||
|
||||
if isFiltering && m.filterInput.Value() == "" {
|
||||
|
|
4
ui/ui.go
4
ui/ui.go
|
@ -137,6 +137,9 @@ type commonModel struct {
|
|||
// ignoring the value portion with an empty struct.
|
||||
filesStashed map[ksuid.KSUID]struct{}
|
||||
|
||||
// ID of the most recently stashed markdown
|
||||
latestFileStashed ksuid.KSUID
|
||||
|
||||
// Files currently being stashed. We remove files from this set once
|
||||
// a stash operation has either succeeded or failed.
|
||||
filesStashing map[ksuid.KSUID]struct{}
|
||||
|
@ -407,6 +410,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||
md := markdown(msg)
|
||||
m.stash.addMarkdowns(&md)
|
||||
m.common.filesStashed[msg.stashID] = struct{}{}
|
||||
m.common.latestFileStashed = msg.stashID
|
||||
delete(m.common.filesStashing, md.stashID)
|
||||
|
||||
if m.stash.filterApplied() {
|
||||
|
|
Loading…
Reference in a new issue