MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / renderPanel

Method renderPanel

ui/fullscreen_backend.go:1065–1093  ·  view source on GitHub ↗
(title, body, pane string, minBodyLines int)

Source from the content-addressed store, hash-verified

1063}
1064
1065func (b *FullscreenRendererBackend) renderPanel(title, body, pane string, minBodyLines int) string {
1066 width := b.panelWidth()
1067 inner := maxInt(12, width-2)
1068 active := b.FocusedPane == pane
1069 borderStyle, titleStyle, marker := b.panelStyles(pane, body, active)
1070 headerPlain := fmt.Sprintf(" %s %s ", marker, title)
1071 header := titleStyle + headerPlain + fullscreenReset + borderStyle
1072 topFill := maxInt(0, inner-runewidth.StringWidth(headerPlain)-1)
1073
1074 lines := []string{
1075 borderStyle + "╭─" + header + strings.Repeat("─", topFill) + "╮" + fullscreenReset,
1076 }
1077 bodyLines := strings.Split(body, "\n")
1078 if strings.TrimSpace(stripANSI(body)) == "" {
1079 bodyLines = []string{fullscreenDim + "暂无内容" + fullscreenReset}
1080 }
1081 for len(bodyLines) < maxInt(1, minBodyLines) {
1082 bodyLines = append(bodyLines, "")
1083 }
1084 if len(bodyLines) > maxInt(1, minBodyLines) {
1085 bodyLines = bodyLines[:maxInt(1, minBodyLines)]
1086 }
1087 for _, line := range bodyLines {
1088 line = truncateVisible(line, inner-2)
1089 lines = append(lines, borderStyle+"│"+fullscreenReset+" "+padVisible(line, inner-2)+" "+borderStyle+"│"+fullscreenReset)
1090 }
1091 lines = append(lines, borderStyle+"╰"+strings.Repeat("─", inner)+"╯"+fullscreenReset)
1092 return strings.Join(lines, "\n")
1093}
1094
1095func (b *FullscreenRendererBackend) panelStyles(pane, body string, active bool) (string, string, string) {
1096 borderStyle := fullscreenDim

Callers 6

renderTasksRegionMethod · 0.95
renderModalRegionMethod · 0.95
renderInputRegionMethod · 0.95
renderStatusRegionMethod · 0.95

Calls 6

panelWidthMethod · 0.95
panelStylesMethod · 0.95
maxIntFunction · 0.85
stripANSIFunction · 0.85
truncateVisibleFunction · 0.85
padVisibleFunction · 0.85

Tested by

no test coverage detected