buildSegment builds a horizontal segment with the given visual width using the provided fill glyph, padding with spaces if needed to match width.
(fill string, width, horizontalWidth int)
| 89 | // buildSegment builds a horizontal segment with the given visual width using |
| 90 | // the provided fill glyph, padding with spaces if needed to match width. |
| 91 | func buildSegment(fill string, width, horizontalWidth int) string { |
| 92 | if width <= 0 { |
| 93 | return "" |
| 94 | } |
| 95 | fillCount := width / horizontalWidth |
| 96 | seg := strings.Repeat(fill, fillCount) |
| 97 | padWidth := width - fillCount*horizontalWidth |
| 98 | if padWidth > 0 { |
| 99 | seg += strings.Repeat(" ", padWidth) |
| 100 | } |
| 101 | return seg |
| 102 | } |
| 103 | |
| 104 | // buildPlainBar builds a horizontal bar (without title) that matches the |
| 105 | // specified visual line width. |
no outgoing calls