update the appropriate lists on keyenter/space

This commit is contained in:
2023-02-25 21:39:11 -08:00
parent 50cf9c7dd5
commit 91545e2e09

View File

@@ -57,10 +57,28 @@ func (m Settings) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch m.cursor {
case authors:
var cmd tea.Cmd
switch msg := msg.(type) {
case tea.KeyMsg:
switch msg.String() {
case "space", "enter":
selected := m.AuthorList.Cursor()
m.AllAuthors[selected].selected = !m.AllAuthors[selected].selected
}
}
m.SelectedAuthors = m.AllAuthors.GetSelected()
m.AuthorList, cmd = m.AuthorList.Update(msg)
return m, cmd
case repos:
var cmd tea.Cmd
switch msg := msg.(type) {
case tea.KeyMsg:
switch msg.String() {
case "space", "enter":
selected := m.RepoList.Cursor()
m.AllRepos[selected].selected = !m.AllRepos[selected].selected
}
}
m.SelectedRepos = m.AllRepos.GetSelected()
m.RepoList, cmd = m.RepoList.Update(msg)
return m, cmd
}