MCPcopy
hub / github.com/wagoodman/dive / RenderHeader

Function RenderHeader

runtime/ui/format/format.go:77–96  ·  view source on GitHub ↗
(title string, width int, selected bool)

Source from the content-addressed store, hash-verified

75}
76
77func RenderHeader(title string, width int, selected bool) string {
78 if selected {
79 body := Header(fmt.Sprintf("%s%s ", selectStr, title))
80 bodyLen := len(vtclean.Clean(body, false))
81 repeatCount := width - bodyLen - 2
82 if repeatCount < 0 {
83 repeatCount = 0
84 }
85 return fmt.Sprintf("%s%s%s%s\n", selectedLeftBracketStr, body, selectedRightBracketStr, strings.Repeat(selectedFillStr, repeatCount))
86 // return fmt.Sprintf("%s%s%s%s\n", Selected(selectedLeftBracketStr), body, Selected(selectedRightBracketStr), Selected(strings.Repeat(selectedFillStr, width-bodyLen-2)))
87 // return fmt.Sprintf("%s%s%s%s\n", Selected(selectedLeftBracketStr), body, Selected(selectedRightBracketStr), strings.Repeat(selectedFillStr, width-bodyLen-2))
88 }
89 body := Header(fmt.Sprintf(" %s ", title))
90 bodyLen := len(vtclean.Clean(body, false))
91 repeatCount := width - bodyLen - 2
92 if repeatCount < 0 {
93 repeatCount = 0
94 }
95 return fmt.Sprintf("%s%s%s%s\n", leftBracketStr, body, rightBracketStr, strings.Repeat(fillStr, repeatCount))
96}
97
98func RenderHelpKey(control, title string, selected bool) string {
99 if selected {

Callers 5

RenderMethod · 0.92
RenderMethod · 0.92
RenderMethod · 0.92
RenderMethod · 0.92
RenderMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected