fix(add-form): align add/edit form behavior (#28)

Co-authored-by: francesco.raso <francesco.raso@elco.it>
This commit is contained in:
Francesco Raso
2026-01-04 18:15:57 +01:00
committed by GitHub
parent 49f01b7494
commit e4570e612e

View File

@@ -282,11 +282,29 @@ func (m *addFormModel) handleNavigation(key string) tea.Cmd {
currentPos++ currentPos++
} }
// Wrap around within current tab // Handle transitions between tabs
if currentPos >= len(currentTabInputs) { if currentPos >= len(currentTabInputs) {
// 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 currentPos = 0
}
} else if currentPos < 0 { } else if currentPos < 0 {
// Move to previous tab
if m.currentTab == tabAdvanced {
// Move to general tab
m.currentTab = tabGeneral
currentTabInputs = m.getInputsForCurrentTab()
currentPos = len(currentTabInputs) - 1 currentPos = len(currentTabInputs) - 1
} else {
// Wrap around to last field of current tab
currentPos = len(currentTabInputs) - 1
}
} }
m.focused = currentTabInputs[currentPos] m.focused = currentTabInputs[currentPos]