fix: fix tui wrap around issue with temp author

This commit is contained in:
Slug-Boi
2025-04-11 15:32:50 +02:00
parent 53419329a0
commit b41ec63fde
+8 -3
View File
@@ -50,7 +50,7 @@ func errorGetMissingFields(m model_ca) {
} }
if len(m.inputs) > 0 { if len(m.inputs) > 0 {
for i := 0; i < inpLen-1; i++ { for i := 0; i < inpLen; i++ {
if m.inputs[i].Value() == "" { if m.inputs[i].Value() == "" {
m.errorModel.missing = append(m.errorModel.missing, "- "+strings.Split(m.inputs[i].Placeholder," (")[0]) m.errorModel.missing = append(m.errorModel.missing, "- "+strings.Split(m.inputs[i].Placeholder," (")[0])
} }
@@ -330,10 +330,15 @@ func (m model_ca) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.focusIndex++ m.focusIndex++
} }
if m.focusIndex > len(m.inputs)+1 { inpNum := len(m.inputs)
if !tempAuthorToggle {
inpNum++
}
if m.focusIndex > inpNum {
m.focusIndex = 0 m.focusIndex = 0
} else if m.focusIndex < 0 { } else if m.focusIndex < 0 {
m.focusIndex = len(m.inputs) m.focusIndex = inpNum
} }
cmds := make([]tea.Cmd, len(m.inputs)) cmds := make([]tea.Cmd, len(m.inputs))