diff options
| author | ewy <ewy0@protonmail.com> | 2026-05-02 19:31:48 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-05-02 19:31:48 +0200 |
| commit | b84ea05c63294cd2c3c5a9329c55e5ed5617d2f7 (patch) | |
| tree | e1342e478a7298e51c6aecf63a492602bcccedf0 /indexers | |
| parent | 45847dc53ec51c090175d8621711250b60b28263 (diff) | |
be more cool about weird icons
Diffstat (limited to 'indexers')
| -rw-r--r-- | indexers/pikdex/index.go | 2 | ||||
| -rw-r--r-- | indexers/pikdex/meta.go | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/indexers/pikdex/index.go b/indexers/pikdex/index.go index 2bb5d36..64e76e6 100644 --- a/indexers/pikdex/index.go +++ b/indexers/pikdex/index.go @@ -77,10 +77,12 @@ func (u *pikdex) Index(absPath string, f fs.FS, runners []model.Runner) ([]model mod := u.mods[absPath] u.Unlock() if mod == nil { + u.Lock() u.mods[absPath] = &SourceData{ Path: absPath, } mod = u.mods[absPath] + u.Unlock() } err = fs.WalkDir(f, root, func(p string, d fs.DirEntry, err error) error { diff --git a/indexers/pikdex/meta.go b/indexers/pikdex/meta.go index af1af93..750ce47 100644 --- a/indexers/pikdex/meta.go +++ b/indexers/pikdex/meta.go @@ -1,6 +1,7 @@ package pikdex import ( + "github.com/charmbracelet/lipgloss" "strings" ) @@ -18,7 +19,11 @@ var MetaFiles = map[string]MetaSetter{ } }, ".icon": func(s *SourceData, content string) { - s.Icon = string([]rune(strip(content))[0:2]) + icon := strip(content) + desiredWidth := lipgloss.Width(icon) + diff := desiredWidth - len([]rune(icon)) + icon += strings.Repeat(" ", diff) + s.Icon = icon }, } |
