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
+20 -7
View File
@@ -57,9 +57,16 @@ func (m Model) dashboardQuitAvailable() bool {
func (p terminalPresentation) helpDialogView(model presentationState) terminalPage {
content := lipgloss.NewStyle().Width(max(1, model.width)).Render(p.contextualHelp(model))
exitHint := "Ctrl+C: exit"
if model.operationActive {
exitHint = "Ctrl+C: defer safe exit"
}
if model.exitDeferred {
exitHint = "Exit pending until safe completion"
}
return terminalPage{
primary: content,
footer: "↑/k ↓/j PgUp/PgDn Home/End: scroll\nq/Esc: close Help Ctrl+C: exit",
footer: "↑/k ↓/j PgUp/PgDn Home/End: scroll\nq/Esc: close Help " + exitHint,
focusLine: -1,
primaryOffset: model.help.offset,
}
@@ -68,7 +75,7 @@ func (p terminalPresentation) helpDialogView(model presentationState) terminalPa
func (p terminalPresentation) contextualHelp(model presentationState) string {
var body strings.Builder
body.WriteString(p.theme.section.Render("Contextual Help"))
body.WriteString("\nOnly the actions listed for this context are accepted while the dialog beneath Help remains unchanged.\n\n")
body.WriteString("\nThis describes the page or dialog beneath Help. While Help is open, only its scrolling and closing keys plus global Ctrl+C are accepted; the underlying state remains unchanged.\n\n")
switch {
case model.confirmation != nil:
@@ -77,20 +84,22 @@ func (p terminalPresentation) contextualHelp(model presentationState) string {
if model.confirmation.Summary != "" {
fmt.Fprintf(&body, "%s\n", model.confirmation.Summary)
}
body.WriteString("Left/Right or Tab changes the focused choice. Enter chooses it. y confirms. n, q, or Escape cancels. ")
body.WriteString("Left/Right, Tab, or Shift+Tab changes the focused choice. Enter chooses it. y confirms. n, q, or Escape cancels. ")
if model.confirmationDialog != nil {
body.WriteByte('\n')
body.WriteString(confirmationFocusDescription(*model.confirmationDialog))
}
body.WriteByte('\n')
case model.profileDelete != nil:
body.WriteString(p.theme.section.Render("Delete confirmation"))
fmt.Fprintf(&body, "\nDelete Proxy Profile %q. Deletion cannot be undone.\n", model.profileDelete.name)
body.WriteString("Left/Right or Tab changes the focused choice. Enter chooses it. y deletes. n, q, or Escape cancels. ")
body.WriteString("Left/Right, Tab, or Shift+Tab changes the focused choice. Enter chooses it. y deletes. n, q, or Escape cancels. ")
body.WriteByte('\n')
body.WriteString(confirmationFocusDescription(model.profileDelete.dialog))
body.WriteByte('\n')
case model.picker.open:
body.WriteString(p.theme.section.Render("Active Profile picker"))
body.WriteString("\nType to filter Proxy Profiles; q is ordinary search input here. Up/Down and PgUp/PgDn select. Enter activates the selection. Escape cancels.\n")
body.WriteString("\nType to filter Proxy Profiles; q is ordinary search input here. Up/Down or Ctrl+P/Ctrl+N selects, and PgUp/PgDn moves by a page. Enter activates the selection. Escape cancels.\n")
case model.driftResolutionTargetID != "":
body.WriteString(p.theme.section.Render("Drift Resolution dialog"))
body.WriteString("\nr reapplies the Active Profile. o restores original configuration when ownership evidence permits. Enter, q, or Escape cancels.\n")
@@ -127,9 +136,13 @@ func (p terminalPresentation) contextualHelp(model presentationState) string {
if model.form.field >= 0 && model.form.field < len(labels) {
fmt.Fprintf(&body, "\nFocus: %s field.\n", labels[model.form.field])
}
body.WriteString("Tab or Down moves to the next field; Shift+Tab or Up moves to the previous field. Ctrl+T changes mode. Ctrl+S saves. q or Escape cancels and returns to Profile management.\n")
body.WriteString("Type to append text and Backspace to delete. Tab or Down moves to the next field; Shift+Tab or Up moves to the previous field. Ctrl+T changes mode. Ctrl+S saves. q or Escape cancels and returns to Profile management.\n")
if model.form.profile.Mode == "single" && model.form.field == 1 {
body.WriteString("Ctrl+D explicitly runs Protocol Probe for the Single proxy URL field.\n")
if model.form.probing {
body.WriteString("Protocol Probe is in progress; Ctrl+D does not start a duplicate probe.\n")
} else {
body.WriteString("Ctrl+D explicitly runs Protocol Probe for the Single proxy URL field.\n")
}
}
default:
body.WriteString(p.theme.section.Render("Dashboard"))