(maxX int)
| 15 | } |
| 16 | |
| 17 | func (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 | } |
no test coverage detected