MCPcopy Index your code
hub / github.com/box-cli-maker/box-cli-maker / addVertPadding

Method addVertPadding

util.go:27–43  ·  view source on GitHub ↗

addVertPadding adds vertical padding lines using the given inner width. innerWidth represents the visible width between the vertical borders.

(innerWidth int)

Source from the content-addressed store, hash-verified

25//
26// innerWidth represents the visible width between the vertical borders.
27func (b *Box) addVertPadding(innerWidth int) ([]string, error) {
28 if innerWidth < 0 {
29 innerWidth = 0
30 }
31 padding := strings.Repeat(" ", innerWidth)
32 vertical, err := applyColor(b.vertical, b.color)
33 if err != nil {
34 return nil, err
35 }
36
37 texts := make([]string, b.py)
38 for i := range texts {
39 texts[i] = vertical + padding + vertical
40 }
41
42 return texts, nil
43}
44
45// longestLine expands tabs in lines and determines longest visible
46// return longest length and array of expanded lines

Callers 2

TestAddVertPaddingFunction · 0.95
RenderMethod · 0.95

Calls 1

applyColorFunction · 0.85

Tested by 1

TestAddVertPaddingFunction · 0.76