(cache *cache.RepoCache, bug *cache.BugCache)
| 35 | } |
| 36 | |
| 37 | func (ls *labelSelect) SetBug(cache *cache.RepoCache, bug *cache.BugCache) { |
| 38 | ls.cache = cache |
| 39 | ls.bug = bug |
| 40 | ls.labels = cache.Bugs().ValidLabels() |
| 41 | |
| 42 | // Find which labels are currently applied to the bug |
| 43 | bugLabels := bug.Snapshot().Labels |
| 44 | labelSelect := make([]bool, len(ls.labels)) |
| 45 | for i, label := range ls.labels { |
| 46 | for _, bugLabel := range bugLabels { |
| 47 | if label == bugLabel { |
| 48 | labelSelect[i] = true |
| 49 | break |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | ls.labelSelect = labelSelect |
| 55 | if len(labelSelect) > 0 { |
| 56 | ls.selected = 0 |
| 57 | } else { |
| 58 | ls.selected = -1 |
| 59 | } |
| 60 | |
| 61 | ls.scroll = 0 |
| 62 | } |
| 63 | |
| 64 | func (ls *labelSelect) keybindings(g *gocui.Gui) error { |
| 65 | // Abort |
nothing calls this directly
no test coverage detected