diff --git a/docs/ux-guide.md b/docs/ux-guide.md index 4064e4f..2689fe6 100644 --- a/docs/ux-guide.md +++ b/docs/ux-guide.md @@ -120,12 +120,12 @@ Changes 5 files · 2M 1A 1D 1R · +37 −12 - Untracked directories are shown as one entry (`tmp/`). ### Header -`path branch ↑↓ · n submodules · … · n pin staged · n loading · ` +`path branch ↑↓ · n submodules · n error · … · n pin staged · n loading · ` Issue counts are ordered by severity (unpushed, conflict, missing, off pin, changed), each in its level color. Zero counts are omitted. `n loading` counts only submodules whose status is still being loaded; ones whose load -failed (shown as `error`) are not counted. A detached +failed are counted separately as `n error` (red, before the issue counts). A detached superproject shows `(detached)` as its branch. `` on the right: diff --git a/internal/tui/header/header.go b/internal/tui/header/header.go index 671bbfa..ade855d 100644 --- a/internal/tui/header/header.go +++ b/internal/tui/header/header.go @@ -36,7 +36,7 @@ func View(t theme.Theme, repo *submodule.Repo, fetch Fetch, spinner string, widt } // count submodules per issue kind (most severe first), plus staged pins - var total, loading, staged int + var total, loading, errored, staged int perKind := map[submodule.IssueKind]int{} level := map[submodule.IssueKind]submodule.Level{} submodule.Walk(repo.Submodules, func(s *submodule.Submodule) { @@ -44,6 +44,8 @@ func View(t theme.Theme, repo *submodule.Repo, fetch Fetch, spinner string, widt if s.Status == nil { if s.Err == nil { loading++ + } else { + errored++ } return } @@ -58,6 +60,9 @@ func View(t theme.Theme, repo *submodule.Repo, fetch Fetch, spinner string, widt sep := seg(t.Muted, " · ") mid := seg(t.Muted, fmt.Sprintf("%d submodules", total)) + if errored > 0 { + mid += sep + t.LevelStyle(submodule.LevelDanger, bar).Render(fmt.Sprintf("%d error", errored)) + } for _, k := range []submodule.IssueKind{ submodule.IssueUnpushed, submodule.IssueConflict, submodule.IssueMissing, submodule.IssueOffPin, submodule.IssueChanged,