feat: a key that can't be used is explained in the picker
The key picker stays open until the link is made, saying "encrypting
with …" meanwhile. A key that can't be read, or doesn't keep to
share.keyRules, is shown in it in red with which rule it misses
("its value has 28 characters; share.keyRules needs 32
(minLength)"), to pick another.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
6 files changed
+73
-16
No files matched your search
@@ -61,6 +61,8 @@ type searchView struct {
|
||||
pickLines []string // what picking is for, above the picker
|
||||
pickHeading string // the picker's title, on its border
|
||||
pickHelp []string // inside it, above the tabs
|
||||
pickBusy string // what picking is doing, under the help
|
||||
pickErr string // why the key picked can't be used
|
||||
|
||||
// loaded are the scopes a search has loaded since the popup opened:
|
||||
// typing loads the scope once, so lists that fail aren't asked for
|
||||
@@ -438,8 +440,7 @@ func (m *Model) handleSearch(msg tea.KeyPressMsg) tea.Cmd {
|
||||
switch {
|
||||
case v.results && v.res < len(v.shown) && v.pick != nil:
|
||||
r, _ := pickable(v.shown[v.res])
|
||||
m.search = nil
|
||||
return v.pick(m, r)
|
||||
return v.pick(m, r) // the picker closes when it's done
|
||||
case v.results && v.res < len(v.shown):
|
||||
m.search = nil
|
||||
return v.shown[v.res].run(m)
|
||||
@@ -667,7 +668,9 @@ func (m Model) searchViewBox() string {
|
||||
listH := max(5, min(m.h-10, 14))
|
||||
if v.pick != nil {
|
||||
// What it's for, the help, the tabs and a border more.
|
||||
listH = max(5, min(m.h-10-len(v.pickLines)-len(v.pickHelp)-5, 14))
|
||||
// What it's for, the help, a line or two on the key picked, the
|
||||
// tabs and a border more.
|
||||
listH = max(5, min(m.h-10-len(v.pickLines)-len(v.pickHelp)-8, 14))
|
||||
}
|
||||
|
||||
srcW := 10
|
||||
@@ -766,6 +769,15 @@ func (m Model) searchViewBox() string {
|
||||
for _, l := range v.pickHelp {
|
||||
body = append(body, " "+l)
|
||||
}
|
||||
switch {
|
||||
case v.pickBusy != "":
|
||||
body = append(body, "", " "+m.st.Notice.Render(v.pickBusy))
|
||||
case v.pickErr != "":
|
||||
body = append(body, "")
|
||||
for _, l := range strings.Split(ansi.Wordwrap(v.pickErr, w-4, " "), "\n") {
|
||||
body = append(body, " "+m.st.Error.Render(l))
|
||||
}
|
||||
}
|
||||
body = append(body, "", " "+m.goToTabs(ts))
|
||||
}
|
||||
body = append(body, " "+v.input.View(), "")
|
||||
|
||||
Reference in new issue
Block a user