| 421 | } |
| 422 | |
| 423 | func (sb *showBug) renderSidebar(g *gocui.Gui, sideView *gocui.View) error { |
| 424 | maxX, _ := sideView.Size() |
| 425 | x0, y0, _, _, _ := g.ViewPosition(sideView.Name()) |
| 426 | maxX += x0 |
| 427 | |
| 428 | snap := sb.bug.Snapshot() |
| 429 | |
| 430 | sb.sideSelectableView = nil |
| 431 | |
| 432 | labelStr := make([]string, len(snap.Labels)) |
| 433 | for i, l := range snap.Labels { |
| 434 | lc := l.Color() |
| 435 | lc256 := lc.Term256() |
| 436 | labelStr[i] = lc256.Escape() + "◼ " + lc256.Unescape() + l.String() |
| 437 | } |
| 438 | |
| 439 | labels := strings.Join(labelStr, "\n") |
| 440 | labels, lines := text.WrapLeftPadded(labels, maxX, 2) |
| 441 | |
| 442 | content := fmt.Sprintf("%s\n\n%s", colors.Bold(" Labels"), labels) |
| 443 | |
| 444 | v, err := sb.createSideView(g, "sideLabels", x0, y0, maxX, lines+2) |
| 445 | if err != nil { |
| 446 | return err |
| 447 | } |
| 448 | |
| 449 | _, _ = fmt.Fprint(v, content) |
| 450 | |
| 451 | return nil |
| 452 | } |
| 453 | |
| 454 | func (sb *showBug) saveAndBack(g *gocui.Gui, v *gocui.View) error { |
| 455 | err := sb.bug.CommitAsNeeded() |