From 5b456104e813623db149129879841ba7038ddf5e Mon Sep 17 00:00:00 2001 From: swanadiva Date: Tue, 23 Jun 2026 15:53:32 +0700 Subject: [PATCH] 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. --- pkg/tui/host_form_tab.go | 10 ++++++---- pkg/tui/key_form_tab.go | 10 ++++++---- pkg/tui/snippet_form_tab.go | 10 ++++++---- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/pkg/tui/host_form_tab.go b/pkg/tui/host_form_tab.go index ab00f8b..edfa7fd 100644 --- a/pkg/tui/host_form_tab.go +++ b/pkg/tui/host_form_tab.go @@ -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 } } diff --git a/pkg/tui/key_form_tab.go b/pkg/tui/key_form_tab.go index 478a822..5f538ac 100644 --- a/pkg/tui/key_form_tab.go +++ b/pkg/tui/key_form_tab.go @@ -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 } } diff --git a/pkg/tui/snippet_form_tab.go b/pkg/tui/snippet_form_tab.go index b960143..63d5560 100644 --- a/pkg/tui/snippet_form_tab.go +++ b/pkg/tui/snippet_form_tab.go @@ -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 } }