diff options
Diffstat (limited to 'indexers/pikdex')
| -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 }, } |
