fix: no cursor on the versions in a secret's details: they're read, not moved in (#28)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit was merged in pull request #28.
This commit is contained in:
1 parent
cbb155b498
commit
c269e2b07c
2 files changed
+12
-7
No files matched your search
@@ -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())
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user