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

Callers 2

queuedHeightMethod · 0.95
ViewMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected