Skip to content

Commit

Permalink
cmd/record: 'e' doesn't trigger online edit mode while filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
joshi4 committed Feb 2, 2024
1 parent daf61e1 commit a952229
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cmd/component/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ func (i ListItem) FilterValue() string {
}

type ListModel struct {
list list.Model
url string
list list.Model
url string
editBinding key.Binding
}

func NewListModel(items []ListItem, title string, url string) ListModel {
Expand All @@ -42,13 +43,13 @@ func NewListModel(items []ListItem, title string, url string) ListModel {
}
m.list.Title = title

editBinding := key.NewBinding(key.WithKeys("e"), key.WithHelp("e", "edit online"))
m.editBinding = key.NewBinding(key.WithKeys("e"), key.WithHelp("e", "edit online"))
m.list.AdditionalFullHelpKeys = func() []key.Binding {
return []key.Binding{editBinding}
return []key.Binding{m.editBinding}
}

m.list.AdditionalShortHelpKeys = func() []key.Binding {
return []key.Binding{editBinding}
return []key.Binding{m.editBinding}
}

m.url = url
Expand Down Expand Up @@ -89,7 +90,7 @@ func (m ListModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, tea.Quit
}

if msg.String() == "e" {
if msg.String() == "e" && m.list.FilterState() == list.Unfiltered {
return m, OpenBrowser(m.url, NopMsg{}, NopMsg{})
}

Expand Down

0 comments on commit a952229

Please sign in to comment.