mirror of
https://github.com/charmbracelet/glow.git
synced 2026-08-20 07:04:17 +02:00
Stashed items get a green indicator in the pager
This commit is contained in:
parent
66dae71253
commit
1d434d64ad
1 changed files with 13 additions and 1 deletions
14
ui/pager.go
14
ui/pager.go
|
|
@ -328,6 +328,15 @@ func pagerStatusBarView(b *strings.Builder, m pagerModel) {
|
|||
// "Help" note
|
||||
helpNote := statusBarHelpStyle(" ? Help ")
|
||||
|
||||
// Status indicator; spinner or stash dot
|
||||
var statusIndicator string
|
||||
if m.currentDocument.markdownType == stashedMarkdown {
|
||||
statusIndicator = te.String(" •").
|
||||
Foreground(common.Green.Color()).
|
||||
Background(statusBarBg.Color()).
|
||||
String()
|
||||
}
|
||||
|
||||
// Note
|
||||
noteText := m.currentDocument.Note
|
||||
if len(noteText) == 0 {
|
||||
|
|
@ -336,6 +345,7 @@ func pagerStatusBarView(b *strings.Builder, m pagerModel) {
|
|||
noteText = truncate(" "+noteText+" ", max(0,
|
||||
m.width-
|
||||
ansi.PrintableRuneWidth(logo)-
|
||||
ansi.PrintableRuneWidth(statusIndicator)-
|
||||
ansi.PrintableRuneWidth(percentText)-
|
||||
ansi.PrintableRuneWidth(helpNote),
|
||||
))
|
||||
|
|
@ -345,14 +355,16 @@ func pagerStatusBarView(b *strings.Builder, m pagerModel) {
|
|||
padding := max(0,
|
||||
m.width-
|
||||
ansi.PrintableRuneWidth(logo)-
|
||||
ansi.PrintableRuneWidth(statusIndicator)-
|
||||
ansi.PrintableRuneWidth(noteText)-
|
||||
ansi.PrintableRuneWidth(percentText)-
|
||||
ansi.PrintableRuneWidth(helpNote),
|
||||
)
|
||||
emptySpace := strings.Repeat(emptyCell, padding)
|
||||
|
||||
fmt.Fprintf(b, "%s%s%s%s%s",
|
||||
fmt.Fprintf(b, "%s%s%s%s%s%s",
|
||||
logo,
|
||||
statusIndicator,
|
||||
statusBarNoteStyle(noteText),
|
||||
emptySpace,
|
||||
statusBarScrollPosStyle(percentText),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue