Introduce filtered list view model

We're going to start supporting filtering of list views
This commit is contained in:
Jesse Duffield
2023-05-27 14:14:43 +10:00
parent fd861826bc
commit a9e2c8129f
43 changed files with 798 additions and 232 deletions

View File

@@ -9,6 +9,7 @@ import (
type PatchExplorerContext struct {
*SimpleContext
*SearchTrait
state *patch_exploring.State
viewTrait *ViewTrait
@@ -28,7 +29,7 @@ func NewPatchExplorerContext(
c *ContextCommon,
) *PatchExplorerContext {
return &PatchExplorerContext{
ctx := &PatchExplorerContext{
state: nil,
viewTrait: NewViewTrait(view),
c: c,
@@ -42,7 +43,18 @@ func NewPatchExplorerContext(
Focusable: true,
HighlightOnFocus: true,
})),
SearchTrait: NewSearchTrait(c),
}
ctx.GetView().SetOnSelectItem(ctx.SearchTrait.onSelectItemWrapper(
func(selectedLineIdx int) error {
ctx.GetMutex().Lock()
defer ctx.GetMutex().Unlock()
return ctx.NavigateTo(ctx.c.IsCurrentContext(ctx), selectedLineIdx)
}),
)
return ctx
}
func (self *PatchExplorerContext) IsPatchExplorerContext() {}