fix: form tab input not responding to typing
Bug: t.inputs[t.focus].Update(msg) discarded the returned textinput.Model, so typed characters were never stored in the input state. Fix: capture both updated model and cmd from textinput.Update(): t.inputs[t.focus], cmd = t.inputs[t.focus].Update(msg) return t, cmd Same fix applied to all 3 forms (host, key, snippet). Also moved ctrl+s out of default to its own case for clarity.
This commit is contained in:
@@ -154,11 +154,13 @@ func (t *HostFormTab) Update(msg tea.Msg) (Tab, tea.Cmd) {
|
||||
case "shift+tab", "up":
|
||||
t.prevField()
|
||||
|
||||
case "ctrl+s":
|
||||
return t.submit()
|
||||
|
||||
default:
|
||||
if msg.String() == "ctrl+s" {
|
||||
return t.submit()
|
||||
}
|
||||
t.inputs[t.focus].Update(msg)
|
||||
var cmd tea.Cmd
|
||||
t.inputs[t.focus], cmd = t.inputs[t.focus].Update(msg)
|
||||
return t, cmd
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,11 +126,13 @@ func (t *KeyFormTab) Update(msg tea.Msg) (Tab, tea.Cmd) {
|
||||
case "shift+tab", "up":
|
||||
t.prevField()
|
||||
|
||||
case "ctrl+s":
|
||||
return t.submit()
|
||||
|
||||
default:
|
||||
if msg.String() == "ctrl+s" {
|
||||
return t.submit()
|
||||
}
|
||||
t.inputs[t.focus].Update(msg)
|
||||
var cmd tea.Cmd
|
||||
t.inputs[t.focus], cmd = t.inputs[t.focus].Update(msg)
|
||||
return t, cmd
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -125,11 +125,13 @@ func (t *SnippetFormTab) Update(msg tea.Msg) (Tab, tea.Cmd) {
|
||||
case "shift+tab", "up":
|
||||
t.prevField()
|
||||
|
||||
case "ctrl+s":
|
||||
return t.submit()
|
||||
|
||||
default:
|
||||
if msg.String() == "ctrl+s" {
|
||||
return t.submit()
|
||||
}
|
||||
t.inputs[t.focus].Update(msg)
|
||||
var cmd tea.Cmd
|
||||
t.inputs[t.focus], cmd = t.inputs[t.focus].Update(msg)
|
||||
return t, cmd
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user