Merge branch 'main' into feat/value-hints
This commit is contained in:
commit
a4f17738cb
13 files changed
+404
-37
No files matched your search
+36
-7
@@ -163,9 +163,13 @@ type Model struct {
|
||||
clip Clipboard
|
||||
clipClear time.Duration
|
||||
openURL func(string) error
|
||||
getenv func(string) string
|
||||
nvimOpen func(server, path string, line int) error // edit.go
|
||||
now func() time.Time
|
||||
// fields is the fourth pane for anything but a secret (now: an
|
||||
// account), with each account's groups as they load (fields.go).
|
||||
fields panes.Fields
|
||||
groups map[string]groupsState
|
||||
getenv func(string) string
|
||||
nvimOpen func(server, path string, line int) error // edit.go
|
||||
now func() time.Time
|
||||
// The cache file, whether the cache changed since it was saved, and
|
||||
// when each provider's Sources list was loaded (persist.go).
|
||||
cachePath string
|
||||
@@ -356,6 +360,8 @@ func New(providers []provider.Provider, opts Options) Model {
|
||||
getenv: os.Getenv,
|
||||
nvimOpen: nvimOpen,
|
||||
cache: newCache(),
|
||||
groups: map[string]groupsState{},
|
||||
fields: panes.NewFields(),
|
||||
}
|
||||
if m.clip == nil {
|
||||
m.clip = clipboard.New()
|
||||
@@ -563,6 +569,9 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
case persistedMsg:
|
||||
m.handlePersisted(msg)
|
||||
|
||||
case groupsMsg:
|
||||
m.groups[msg.provider] = groupsState{names: msg.names, err: msg.err}
|
||||
|
||||
case crawlMsg:
|
||||
cmds = append(cmds, m.handleCrawl(msg))
|
||||
|
||||
@@ -723,8 +732,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
m.askHandlerSetup()
|
||||
m.keys.Login.SetEnabled(m.loginFor() != nil)
|
||||
m.detail.SetMessage(m.selectedProblem())
|
||||
acct, _ := m.selectedAccount()
|
||||
m.detail.SetAccount(acct.Fields)
|
||||
cmds = append(cmds, m.syncFields())
|
||||
if m.anyLoading() && !m.spinning {
|
||||
m.spinning = true
|
||||
cmds = append(cmds, m.spin.Tick)
|
||||
@@ -791,8 +799,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() {
|
||||
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
|
||||
}
|
||||
case key.Matches(msg, k.Pane1):
|
||||
m.focus = paneSources
|
||||
case key.Matches(msg, k.Pane2):
|
||||
@@ -914,6 +928,10 @@ func (m *Model) focusedFilter() filterable {
|
||||
return &m.containers
|
||||
case paneSecrets:
|
||||
return &m.secrets
|
||||
case paneDetail:
|
||||
if m.fields.Shown() {
|
||||
return &m.fields
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -928,7 +946,11 @@ func (m *Model) move(delta int) {
|
||||
case paneSecrets:
|
||||
m.secrets.Move(delta)
|
||||
case paneDetail:
|
||||
m.detail.Scroll(delta)
|
||||
if m.fields.Shown() {
|
||||
m.fields.Move(delta)
|
||||
} else {
|
||||
m.detail.Scroll(delta)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -948,6 +970,10 @@ func (m *Model) jump(top bool) {
|
||||
m.secrets.Top()
|
||||
case m.focus == paneSecrets:
|
||||
m.secrets.Bottom()
|
||||
case m.focus == paneDetail && m.fields.Shown() && top:
|
||||
m.fields.Top()
|
||||
case m.focus == paneDetail && m.fields.Shown():
|
||||
m.fields.Bottom()
|
||||
case m.focus == paneDetail && top:
|
||||
m.detail.ScrollTop()
|
||||
case m.focus == paneDetail:
|
||||
@@ -1458,6 +1484,9 @@ func (m *Model) copyValue() tea.Cmd {
|
||||
if a, ok := m.selectedAccount(); ok && a.Copy != "" && m.focus == paneSources {
|
||||
return m.copyText(a.CopyLabel, a.Copy, false)
|
||||
}
|
||||
if f, ok := m.fields.Selected(); ok && m.focus == paneDetail && m.fields.Shown() {
|
||||
return m.copyText(fieldName(f), f.Value, false)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if v, ok := m.detail.Value(); ok {
|
||||
@@ -1583,7 +1612,7 @@ func (m Model) footerView() string {
|
||||
} else if l != nil && l.Filtering() {
|
||||
help = m.helpBar(keys.FilterHelp{Map: m.keys}.ShortHelp(), 2)
|
||||
} else {
|
||||
help = m.helpBar(contextHelp{k: m.keys, focus: m.focus, commands: len(m.commandsHere()) > 0}.ShortHelp(), 2)
|
||||
help = m.helpBar(contextHelp{k: m.keys, focus: m.focus, commands: len(m.commandsHere()) > 0, account: m.fields.Shown()}.ShortHelp(), 2)
|
||||
}
|
||||
var lines []string
|
||||
if !m.clipDeadline.IsZero() {
|
||||
|
||||
Reference in new issue
Block a user