fix: no cursor on the versions in a secret's details: they're read, not moved in #28

Merged
keb merged 1 commits from fix/versions-no-arrow into main 2026-10-12 08:57:09 +02:00
2 changed files with 12 additions and 7 deletions

No files matched your search

+6 -3
View File
@@ -494,14 +494,17 @@ func TestVersionHistoryInDetail(t *testing.T) {
screen := d.screen()
for _, want := range []string{
"versions 3 · v to browse",
"▸ 3f9c2a 2026-09-01 current", // the version shown above
" 91d3e0 2026-03-01 expired",
" 0a77c4 2025-09-01 disabled",
" 3f9c2a 2026-09-01 current",
" 91d3e0 2026-03-01 expired",
" 0a77c4 2025-09-01 disabled",
} {
if !strings.Contains(screen, want) {
t.Errorf("missing %q:\n%s", want, screen)
}
}
if strings.Contains(screen, "▸ 3f9c2a") {
t.Errorf("a cursor on a list that can't be moved in:\n%s", screen)
}
d.keys("3", "j") // api-key: only its current version
if !strings.Contains(d.screen(), "versions 1") || strings.Contains(d.screen(), "v to browse") {
t.Errorf("wrong history for api-key:\n%s", d.screen())
+6 -4
View File
@@ -362,11 +362,13 @@ func (d Detail) versionLines(st styles.Styles) []string {
out = append(out, muted(fmt.Sprintf(" … %d more", len(d.versions)-i)))
break
}
marker := " "
if d.secret.Version != "" && v.Version == d.secret.Version {
marker = "▸ " // the version shown above
// A list to read, not to move in (v browses them): no cursor. The
// version shown above, when it isn't the current one, is named.
line := " " + VersionLine(st, v, d.Now(), current)
if d.secret.Version != "" && v.Version == d.secret.Version && v.Version != current {
line += muted(" · shown above")
}
out = append(out, " "+marker+VersionLine(st, v, d.Now(), current))
out = append(out, line)
}
return out
}