forked from varia/go-sh-manymanuals
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.
This commit is contained in:
parent
5a2e20f0df
commit
6d35093b6c
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…
Reference in New Issue
Block a user