MCPcopy Index your code
hub / github.com/git-bug/git-bug / renderSidebar

Method renderSidebar

termui/show_bug.go:423–452  ·  view source on GitHub ↗
(g *gocui.Gui, sideView *gocui.View)

Source from the content-addressed store, hash-verified

421}
422
423func (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
454func (sb *showBug) saveAndBack(g *gocui.Gui, v *gocui.View) error {
455 err := sb.bug.CommitAsNeeded()

Callers 1

layoutMethod · 0.95

Calls 9

createSideViewMethod · 0.95
SnapshotMethod · 0.80
Term256Method · 0.80
EscapeMethod · 0.80
UnescapeMethod · 0.80
NameMethod · 0.65
ColorMethod · 0.65
StringMethod · 0.65
SizeMethod · 0.45

Tested by

no test coverage detected