MCPcopy Index your code
hub / github.com/codehamr/codehamr / renderQueued

Method renderQueued

internal/tui/render.go:124–144  ·  view source on GitHub ↗

renderQueued draws the pending-prompt box shown above the divider while a turn runs: a faint title line plus a rounded panel with the collapsed echo, so the user sees what will auto-submit when the turn ends and how to recall it. Empty when nothing is queued.

()

Source from the content-addressed store, hash-verified

122// runs: a faint title line plus a rounded panel with the collapsed echo, so the
123// user sees what will auto-submit when the turn ends and how to recall it. Empty
124// when nothing is queued.
125func (m Model) renderQueued() string {
126 if m.queued == nil {
127 return ""
128 }
129 // Width-3 leaves the border total at width-1, matching the divider's blank
130 // last column (the macOS last-column-wrap guard in View). lipgloss wraps the
131 // body to fit the inner width.
132 inner := max(m.width-3, 1)
133 // Wrap to the box's content width (inner minus Padding(0,1)) BEFORE capping,
134 // so the cap bounds VISUAL rows: a single long echo line would otherwise
135 // soft-wrap inside lipgloss after the cap counted it as one line, and the
136 // box could still push the status bar off-screen.
137 lines := strings.Split(ansi.Wrap(m.queued.echo, max(inner-2, 1), ""), "\n")
138 extra := 0
139 if len(lines) > queuedBodyCap {
140 extra = len(lines) - queuedBodyCap
141 lines = lines[:queuedBodyCap]
142 }
143 body := strings.Join(lines, "\n")
144 if extra > 0 {
145 body += fmt.Sprintf("\n+%d more", extra)
146 }
147 box := styleQueued.Width(inner).Render(body)

Callers 2

queuedHeightMethod · 0.95
ViewMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected