feat: lazysecrets list's marks take space only when present
This commit is contained in:
2 files changed
+11
-12
No files matched your search
@@ -169,9 +169,9 @@ func nameOf(e listing.Entry, theme styles.Styles, color bool) string {
|
||||
|
||||
// marks says what goes before the name, in a field of its own so a
|
||||
// search leaves it out: ★ for a starred entry, ◷ for one used lately,
|
||||
// ⚠ for one expiring within warn and ✗ for an expired one (as the TUI
|
||||
// marks them; a space as wide where it isn't, so names line up), then the
|
||||
// provider's icon.
|
||||
// ⚠ for one expiring within warn and ✗ for an expired one, as the TUI
|
||||
// marks them, then the provider's icon. Only the marks an entry has take
|
||||
// space.
|
||||
type marks struct {
|
||||
theme styles.Styles
|
||||
icons icons.Set
|
||||
@@ -184,10 +184,9 @@ func (m marks) of(e listing.Entry) string {
|
||||
render := renderer(m.color)
|
||||
var parts []string
|
||||
mark := func(on bool, st lipgloss.Style, s string) {
|
||||
if !on {
|
||||
s = " "
|
||||
if on {
|
||||
parts = append(parts, render(st, s))
|
||||
}
|
||||
parts = append(parts, render(st, s))
|
||||
}
|
||||
if m.stars {
|
||||
mark(e.Starred, m.theme.Favourite, "★")
|
||||
|
||||
Reference in new issue
Block a user