MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / renderCategory

Method renderCategory

internal/tui/help.go:219–252  ·  view source on GitHub ↗

renderCategory renders a single category of shortcuts.

(w *strings.Builder, cat ShortcutCategory, width int)

Source from the content-addressed store, hash-verified

217
218// renderCategory renders a single category of shortcuts.
219func (h *HelpOverlay) renderCategory(w *strings.Builder, cat ShortcutCategory, width int) {
220 // Category header
221 catStyle := lipgloss.NewStyle().
222 Bold(true).
223 Foreground(PrimaryColor)
224 w.WriteString(catStyle.Render(cat.Name))
225 w.WriteString("\n")
226
227 // Shortcuts
228 keyStyle := lipgloss.NewStyle().
229 Foreground(TextBrightColor).
230 Bold(true)
231 descStyle := lipgloss.NewStyle().
232 Foreground(TextColor)
233
234 for _, shortcut := range cat.Shortcuts {
235 key := keyStyle.Render(shortcut.Key)
236 desc := descStyle.Render(shortcut.Description)
237
238 // Calculate padding for alignment
239 keyWidth := lipgloss.Width(key)
240 padding := 10 - keyWidth
241 if padding < 1 {
242 padding = 1
243 }
244
245 w.WriteString(" ")
246 w.WriteString(key)
247 w.WriteString(strings.Repeat(" ", padding))
248 w.WriteString(desc)
249 w.WriteString("\n")
250 }
251 w.WriteString("\n")
252}
253
254// centerModal centers the modal on the screen.
255func (h *HelpOverlay) centerModal(modal string) string {

Callers 1

RenderMethod · 0.95

Calls 1

RenderMethod · 0.45

Tested by

no test coverage detected