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

Method Render

termui/help_bar.go:17–35  ·  view source on GitHub ↗
(maxX int)

Source from the content-addressed store, hash-verified

15}
16
17func (hb helpBar) Render(maxX int) string {
18 var builder strings.Builder
19
20 il := len(hb) - 1
21 for i, entry := range hb {
22 builder.WriteString(colors.White(colors.BlackBg(fmt.Sprintf("[%s] %s", entry.keys, entry.text))))
23
24 if i < il {
25 builder.WriteString(" ")
26 }
27 }
28
29 tl := text.Len(builder.String())
30 if tl < maxX {
31 builder.WriteString(colors.White(colors.BlackBg(strings.Repeat(" ", maxX-tl))))
32 }
33
34 return builder.String()
35}

Callers 3

renderHelpMethod · 0.80
layoutMethod · 0.80
layoutMethod · 0.80

Calls 2

StringMethod · 0.65
LenMethod · 0.45

Tested by

no test coverage detected