| 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "strings" |
| 5 | ) |
| 6 | |
| 7 | func historySearchRootFilter(a *App, req HistorySearchRequest) []string { |
| 8 | rootFilter := []string{} |
| 9 | for _, root := range historyCatalogRoots(a.sessionCatalogTargets()) { |
| 10 | if req.Scope == "project" && (root.Scope != "project" || !sameProjectRoot(root.WorkspaceRoot, req.WorkspaceRoot)) { |
| 11 | continue |
| 12 | } |
| 13 | if req.Scope == "global" && root.Scope == "project" { |
| 14 | continue |
| 15 | } |
| 16 | rootFilter = append(rootFilter, root.Path) |
| 17 | } |
| 18 | return rootFilter |
| 19 | } |
| 20 | |
| 21 | func historyStatusMatches(status string, open, current bool) bool { |
| 22 | switch strings.TrimSpace(status) { |
| 23 | case "open": |
| 24 | // Match HistoryPanel: open-but-not-current. |
| 25 | return open && !current |
| 26 | case "current": |
| 27 | return current |
| 28 | default: |
| 29 | return true |
| 30 | } |
| 31 | } |
| 32 |