From e4570e612e762ca8e0e1b8b28efa9410097e8c6a Mon Sep 17 00:00:00 2001 From: Francesco Raso <116293603+0xfraso@users.noreply.github.com> Date: Sun, 4 Jan 2026 18:15:57 +0100 Subject: [PATCH] fix(add-form): align add/edit form behavior (#28) Co-authored-by: francesco.raso --- internal/ui/add_form.go | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/internal/ui/add_form.go b/internal/ui/add_form.go index 8cbeda4..5ccb1cd 100644 --- a/internal/ui/add_form.go +++ b/internal/ui/add_form.go @@ -282,11 +282,29 @@ func (m *addFormModel) handleNavigation(key string) tea.Cmd { currentPos++ } - // Wrap around within current tab + // Handle transitions between tabs if currentPos >= len(currentTabInputs) { - currentPos = 0 + // Move to next tab + if m.currentTab == tabGeneral { + // Move to advanced tab + m.currentTab = tabAdvanced + m.focused = m.getFirstInputForTab(tabAdvanced) + return m.updateFocus() + } else { + // Wrap around to first field of current tab + currentPos = 0 + } } else if currentPos < 0 { - currentPos = len(currentTabInputs) - 1 + // Move to previous tab + if m.currentTab == tabAdvanced { + // Move to general tab + m.currentTab = tabGeneral + currentTabInputs = m.getInputsForCurrentTab() + currentPos = len(currentTabInputs) - 1 + } else { + // Wrap around to last field of current tab + currentPos = len(currentTabInputs) - 1 + } } m.focused = currentTabInputs[currentPos]