Browse Source

refactor: enter fires query, "o" opens a datasheet

This will help make the searching more useful since firing a slow query
on an incomplete search term will be no bueno. So, we let the user hit
Enter and confirm a search query when doing content queries.
main
decentral1se 12 months ago
parent
commit
6d35093b6c
No known key found for this signature in database GPG Key ID: 3789458B3D0C410
  1. 8
      gshmm.go

8
gshmm.go

@ -218,8 +218,8 @@ func filterDatasheetContents(m model) []string {
// wait for datasheetsLoaded to go true
// then iterate m.datasheets and index them
//
// for this function, catch 3 chars or more in the textinput
// start the query, fire the spinner and block any other queries
// for this function, wait until Enter is hit to fire the query,
// run the query, fire the spinner and block any other queries
// coming in. return the list hits that come back from the query
return []string{}
}
@ -294,7 +294,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, tea.Quit
case "tab":
m.toggleFilterMode()
case "enter":
case "o":
selectedDatasheet := m.datasheets[len(m.datasheets)-1]
// TODO: handle error
_ = xdg.Open(selectedDatasheet.absPath)
@ -336,7 +336,7 @@ func (m model) View() string {
}
body.WriteString("\n" + mode)
help := "[ctrl-c]: quit | [tab]: filter mode | [enter]: open"
help := "[ctrl-c]: quit | [tab]: filter mode | [o]: open"
body.WriteString("\n" + help)
return body.String()

Loading…
Cancel
Save