mirror of
https://github.com/charmbracelet/crush.git
synced 2025-08-02 05:20:46 +03:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user