fix: form label cleanup and hotkey passthrough

- Remove duplicate labels from renderForm (textinput.Prompt already shows label)
- Pass modifier key combos through form handler to global hotkey handlers
- Update forward form footer for clarity

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
JiXieShi
2026-05-24 02:28:45 +08:00
parent 7b6f4f03ab
commit 9bfb664838
+7 -7
View File
@@ -405,21 +405,21 @@ func (m *Model) handleFormKey(msg tea.KeyMsg) (bool, tea.Cmd) {
func (m *Model) renderForm() string { func (m *Model) renderForm() string {
lines := make([]boxLine, 0, len(m.formFields)+2) lines := make([]boxLine, 0, len(m.formFields)+2)
for i, f := range m.formFields { for i, f := range m.formFields {
label := ""
if i < len(m.formLabels) {
label = m.formLabels[i]
}
prefix := " " prefix := " "
if i == m.formFocus { if i == m.formFocus {
prefix = "▸ " prefix = "▸ "
} }
lines = append(lines, boxLine{ lines = append(lines, boxLine{
text: prefix + label + "\n" + f.View(), text: prefix + f.View(),
style: modalBodyLineStyle(), style: modalBodyLineStyle(),
}) })
} }
lines = append(lines, boxLine{text: "Tab switch | Enter submit | Esc cancel", style: modalFooterLineStyle()}) footer := "Tab cycles Type | Enter submit | Esc cancel"
return renderBox(m.formTitle, lines, 40, m.availableModalWidth()) if len(m.formFields) > 1 {
footer = "Tab/Shift+Tab switch | Enter submit | Esc cancel"
}
lines = append(lines, boxLine{text: footer, style: modalFooterLineStyle()})
return renderBox(m.formTitle, lines, 36, m.availableModalWidth())
} }
func (m *Model) handlePromptKey(msg tea.KeyMsg) (bool, tea.Cmd) { func (m *Model) handlePromptKey(msg tea.KeyMsg) (bool, tea.Cmd) {