Small bug fix to table select filtering
This commit is contained in:
parent
aa828df3ae
commit
826a28664a
|
@ -7,7 +7,7 @@ type tableItem struct {
|
|||
}
|
||||
|
||||
func (ti tableItem) FilterValue() string {
|
||||
return ""
|
||||
return ti.name
|
||||
}
|
||||
|
||||
func (ti tableItem) Title() string {
|
||||
|
|
|
@ -26,7 +26,9 @@ func newListController(tableNames []string, w, h int) listController {
|
|||
delegate := list.NewDefaultDelegate()
|
||||
delegate.ShowDescription = false
|
||||
|
||||
return listController{list.New(items, delegate, w, h)}
|
||||
list := list.New(items, delegate, w, h)
|
||||
|
||||
return listController{list: list}
|
||||
}
|
||||
|
||||
func (l listController) Init() tea.Cmd {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package tableselect
|
||||
|
||||
import (
|
||||
"github.com/charmbracelet/bubbles/list"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/lmika/awstools/internal/dynamo-browse/controllers"
|
||||
"github.com/lmika/awstools/internal/dynamo-browse/ui/teamodels/layout"
|
||||
|
@ -38,16 +39,18 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||
if m.pendingSelection != nil {
|
||||
switch msg.String() {
|
||||
case "enter":
|
||||
if m.listController.list.FilterState() != list.Filtering {
|
||||
var sel controllers.PromptForTableMsg
|
||||
sel, m.pendingSelection = *m.pendingSelection, nil
|
||||
|
||||
return m, sel.OnSelected(m.listController.list.SelectedItem().(tableItem).name)
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
m.listController = cc.Collect(m.listController.Update(msg)).(listController)
|
||||
return m, cc.Cmd()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m.submodel = cc.Collect(m.submodel.Update(msg))
|
||||
return m, cc.Cmd()
|
||||
|
|
Loading…
Reference in a new issue