fix(onboarding): fix y/n key press on model list and api key field (#402)

A bug on onboarding made it impossible to press "y" and "n" on
onboarding, on both the model list and the API key field.

This also means that on some terminals, like the Windows Terminal,
pasting an API key would supress all "y" and "n" chars present in the
key, because these terminal receives an even for each character being
pressed.
This commit is contained in:
Andrey Nering
2025-07-31 10:57:31 -03:00
committed by GitHub
parent 0174951a46
commit e69b513e1a

View File

@@ -262,30 +262,34 @@ func (s *splashCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return s, nil
}
case key.Matches(msg, s.keyMap.Yes):
if s.isOnboarding {
return s, nil
}
if s.needsAPIKey {
u, cmd := s.apiKeyInput.Update(msg)
s.apiKeyInput = u.(*models.APIKeyInput)
return s, cmd
}
if s.isOnboarding {
u, cmd := s.modelList.Update(msg)
s.modelList = u
return s, cmd
}
if s.needsProjectInit {
return s, s.initializeProject()
}
case key.Matches(msg, s.keyMap.No):
if s.isOnboarding {
return s, nil
}
if s.needsAPIKey {
u, cmd := s.apiKeyInput.Update(msg)
s.apiKeyInput = u.(*models.APIKeyInput)
return s, cmd
}
s.selectedNo = true
return s, s.initializeProject()
if s.isOnboarding {
u, cmd := s.modelList.Update(msg)
s.modelList = u
return s, cmd
}
if s.needsProjectInit {
s.selectedNo = true
return s, s.initializeProject()
}
default:
if s.needsAPIKey {
u, cmd := s.apiKeyInput.Update(msg)