Add multiselect board filters and letter-jump on picker menus.
Persist comma-separated list filters per project, toggle with space, and jump by first letter in board and project pickers. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package views
|
||||
|
||||
import (
|
||||
"unicode"
|
||||
|
||||
"github.com/charmbracelet/bubbles/list"
|
||||
|
||||
"task/internal/project"
|
||||
@@ -46,6 +48,33 @@ func NewProjectList(projects []project.Project, activeID string, width, height i
|
||||
return l
|
||||
}
|
||||
|
||||
// JumpProjectByLetter cycles to the next project whose name starts with r.
|
||||
func JumpProjectByLetter(l *list.Model, r rune) bool {
|
||||
r = unicode.ToLower(r)
|
||||
items := l.Items()
|
||||
n := len(items)
|
||||
if n == 0 {
|
||||
return false
|
||||
}
|
||||
start := l.Index()
|
||||
for step := 1; step <= n; step++ {
|
||||
i := (start + step) % n
|
||||
pi, ok := items[i].(ProjectItem)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
name := []rune(pi.Project.Name)
|
||||
if len(name) == 0 {
|
||||
continue
|
||||
}
|
||||
if unicode.ToLower(name[0]) == r {
|
||||
l.Select(i)
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// ProjectsToItems converts projects to list items.
|
||||
func ProjectsToItems(projects []project.Project, activeID string) []list.Item {
|
||||
items := make([]list.Item, len(projects))
|
||||
|
||||
Reference in New Issue
Block a user