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 10 additions and 5 deletions
Showing only changes of commit c728033436 - Show all commits

No files matched your search

+4 -1
View File
@@ -494,7 +494,7 @@ func TestVersionHistoryInDetail(t *testing.T) {
screen := d.screen() screen := d.screen()
for _, want := range []string{ for _, want := range []string{
"versions 3 · v to browse", "versions 3 · v to browse",
"▸ 3f9c2a 2026-09-01 current", // the version shown above " 3f9c2a 2026-09-01 current",
" 91d3e0 2026-03-01 expired", " 91d3e0 2026-03-01 expired",
" 0a77c4 2025-09-01 disabled", " 0a77c4 2025-09-01 disabled",
} { } {
@@ -502,6 +502,9 @@ func TestVersionHistoryInDetail(t *testing.T) {
t.Errorf("missing %q:\n%s", want, screen) 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 d.keys("3", "j") // api-key: only its current version
if !strings.Contains(d.screen(), "versions 1") || strings.Contains(d.screen(), "v to browse") { 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()) 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))) out = append(out, muted(fmt.Sprintf(" … %d more", len(d.versions)-i)))
break break
} }
marker := " " // A list to read, not to move in (v browses them): no cursor. The
if d.secret.Version != "" && v.Version == d.secret.Version { // version shown above, when it isn't the current one, is named.
marker = "▸ " // the version shown above 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 return out
} }