fix: align contextual action hints

This commit is contained in:
proxyctl coordinator
2026-07-18 00:06:20 +08:00
parent c93dc61ef6
commit fe06963e84
3 changed files with 158 additions and 20 deletions
+19 -10
View File
@@ -22,9 +22,6 @@ func (p terminalPresentation) mainView(model presentationState, width, height in
catalog := newTargetCatalog(model.snapshot, model.showUnavailable, model.selectedTargetID)
footer := p.dashboardFooter(model, catalog)
if model.confirmation != nil && !model.operationActive {
footer = "←/→/Tab: choose y: confirm Enter: choose n/q/Esc: cancel ?: help"
}
if model.currentError != nil {
footer += "\ne: expand/collapse current error x: acknowledge error"
if model.errorExpanded {
@@ -91,14 +88,14 @@ func (p terminalPresentation) driftResolutionView(selected app.TargetSnapshot) (
}
func (p terminalPresentation) dashboardFooter(model presentationState, catalog targetCatalog) string {
if model.exitDeferred {
return "Exit pending; browsing remains safe while the current mutation completes"
}
visibility := "u: show unavailable"
if model.showUnavailable {
visibility = "u: hide unavailable"
}
if model.dashboardFocus == targetDetailsPane {
if model.exitDeferred {
return "↑/k ↓/j PgUp/PgDn: browse Tab: focus Targets " + visibility + " ?: help\nExit pending; new work disabled until safe completion"
}
if model.width < wideWidth {
if model.operationActive {
return "↑/k ↓/j PgUp/PgDn: browse Tab: focus Targets\n?: help q/Ctrl+C: defer exit; mutations disabled"
@@ -110,11 +107,14 @@ func (p terminalPresentation) dashboardFooter(model presentationState, catalog t
}
footer := "↑/k ↓/j PgUp/PgDn: scroll Tab: focus Targets " + visibility + "\np: switch Active Profile m: manage Proxy Profiles ?: help q/Ctrl+C: quit"
if model.operationActive {
footer = "↑/k ↓/j PgUp/PgDn: scroll Tab: focus Targets ?: help\nMutations disabled: wait for the current mutation to finish"
footer = "↑/k ↓/j PgUp/PgDn: scroll Tab: focus Targets " + visibility + " ?: help\nq/Ctrl+C: defer safe exit; mutations disabled"
}
return footer
}
actions := "↑/k ↓/j: select Tab: focus details " + visibility
if model.exitDeferred {
return actions + " ?: help\nExit pending; new work disabled until safe completion"
}
selected, ok := catalog.selected(model.selectedTargetID)
availability := targetMutationAvailability(selected, ok, model.operationActive || model.exitDeferred)
label := targetActionLabel(selected.PrimaryAction.Kind)
@@ -125,9 +125,9 @@ func (p terminalPresentation) dashboardFooter(model presentationState, catalog t
}
if model.width < wideWidth {
if availability.available {
actions = "Space: " + label + " ↑/k ↓/j: select Tab: details"
actions = "Space: " + label + " ↑/k ↓/j: select Tab: focus details"
} else {
actions = "Space: " + label + " disabled ↑/k ↓/j: select Tab: details"
actions = "Space: " + label + " disabled ↑/k ↓/j: select Tab: focus details"
}
if model.operationActive {
@@ -236,10 +236,19 @@ func (p terminalPresentation) formView(model presentationState) terminalPage {
}
fmt.Fprintf(&fields, "%s%s: %s", cursor, label, value)
}
secondaryHints := "?: help q/Esc: cancel"
if model.form.profile.Mode == profile.SingleMode && model.form.field == 1 {
probeHint := "Ctrl+D: probe"
if model.form.probing {
probeHint = "Protocol Probe in progress"
}
secondaryHints = probeHint + " " + secondaryHints
}
footer := "Tab/Shift+Tab/↑/↓: move Ctrl+T: mode Ctrl+S: save\n" + secondaryHints
return terminalPage{
header: p.theme.title.Render(fmt.Sprintf("%s Proxy Profile — %s mode", action, model.form.profile.Mode)),
primary: fields.String(),
footer: "Tab/↑/↓: move Ctrl+T: mode Ctrl+S: save\nCtrl+D: probe ?: help q/Esc: cancel",
footer: footer,
focusLine: model.form.field,
}
}