feat: the right pane describes what's selected in the pane you're in (#9)

The right pane kept showing the selected secret when you moved to Vaults or Sources. Now it follows focus:

| focus | right pane |
|---|---|
| Sources | the account (group row), or the subscription / workspace / repo: name, note, ID / profile / path, host or remote, account, web page, vault count |
| Vaults | the vault / scope / file: name, note, URI / backend / format, source, web page, counts of loaded secrets, keys, certificates |
| Secrets | the secret, as before |
| the right pane itself | what it described when you went in; `shift+tab` goes back there |

All but the secret use the `Fields` pane (#7), so `j`/`k`, `/` and `y` work on them; `Detail` loses the error message it got in #4, which is now a red "problem" row in `Fields`. A value revealed from a left pane stays in view until hidden, so `space` from any pane still shows it. `tab` from a subscription goes to Vaults as before; only an account row skips to its details.

This also changes the startup view: focus starts in Sources, so the right pane describes the first subscription instead of the first secret (golden output updated). Tests that read the secret pane focus Secrets first; a new test walks secret → vault → subscription → into the pane → back, and reveals from Sources.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Karl-Einar Bergstrøm <karl-einarb@outlook.com>
Reviewed-on: #9
This commit was merged in pull request #9.
This commit is contained in:
keb committed 2026-10-11 10:59:40 +02:00
1 parent c8abc1dc95
commit 1c8d69d957
9 files changed
+232 -67

No files matched your search

+12 -7
View File
@@ -163,9 +163,11 @@ type Model struct {
clip Clipboard
clipClear time.Duration
openURL func(string) error
// fields is the fourth pane for anything but a secret (now: an
// account), with each account's groups as they load (fields.go).
// fields is the fourth pane for anything but a secret, with each
// account's groups as they load; lastLeft is the left pane it
// describes while the fourth has focus (fields.go).
fields panes.Fields
lastLeft pane
groups map[string]groupsState
getenv func(string) string
nvimOpen func(server, path string, line int) error // edit.go
@@ -731,7 +733,9 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.waiting = 0
m.askHandlerSetup()
m.keys.Login.SetEnabled(m.loginFor() != nil)
m.detail.SetMessage(m.selectedProblem())
if m.focus != paneDetail {
m.lastLeft = m.focus
}
cmds = append(cmds, m.syncFields())
if m.anyLoading() && !m.spinning {
m.spinning = true
@@ -799,13 +803,14 @@ func (m *Model) handleKey(msg tea.KeyPressMsg) (cmd tea.Cmd, quit bool) {
m.jump(false)
case key.Matches(msg, k.NextPane):
m.focus = (m.focus + 1) % paneCount
if m.focus == paneContainers && m.fields.Shown() {
if r, ok := m.sources.Selected(); ok && m.focus == paneContainers && r.kind == rowGroup {
m.focus = paneDetail // an account's row: nothing between
}
case key.Matches(msg, k.PrevPane):
m.focus = (m.focus + paneCount - 1) % paneCount
if m.focus == paneSecrets && m.fields.Shown() {
m.focus = paneSources
if m.focus == paneDetail {
m.focus = m.lastLeft // back to what it describes
} else {
m.focus = (m.focus + paneCount - 1) % paneCount
}
case key.Matches(msg, k.Pane1):
m.focus = paneSources