fix: remember to toggle off tempAuthorAdd when quitting

This commit is contained in:
Slug-Boi
2025-04-11 16:05:13 +02:00
parent 951dbee1d0
commit c24c277fb1
+4 -1
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])
} }
@@ -276,6 +276,7 @@ func (m model_ca) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case tea.KeyMsg: case tea.KeyMsg:
switch msg.String() { switch msg.String() {
case "ctrl+c", "esc": case "ctrl+c", "esc":
tempAuthorToggle = false
m.inputs = nil m.inputs = nil
if parent_m.keys != nil { if parent_m.keys != nil {
return nil, nil return nil, nil
@@ -315,9 +316,11 @@ func (m model_ca) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, nil return m, nil
} }
if parent_m.keys != nil { if parent_m.keys != nil {
tempAuthorToggle = false
return model{list: parent_m.list}, tea.ClearScreen return model{list: parent_m.list}, tea.ClearScreen
} else { } else {
m.quitting = true m.quitting = true
tempAuthorToggle = false
return m, tea.Quit return m, tea.Quit
} }
} }