mirror of
https://github.com/jixishi/SerialTerminalForWindowsTerminal.git
synced 2026-06-15 16:42:46 +00:00
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:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user