MCPcopy Create free account
hub / github.com/codehamr/codehamr / View

Method View

internal/tui/render.go:240–269  ·  view source on GitHub ↗

View renders only the live bottom region: in-flight streaming tokens, the popover, a divider, the prompt, and the status bar. Everything else has already gone to scrollback via tea.Println, scrolled with the terminal's own wheel/PgUp like any shell session.

()

Source from the content-addressed store, hash-verified

238 row++
239 }
240 return row + 1
241}
242
243// View renders only the live bottom region: in-flight streaming tokens, the
244// popover, a divider, the prompt, and the status bar. Everything else has
245// already gone to scrollback via tea.Println, scrolled with the terminal's
246// own wheel/PgUp like any shell session.
247func (m Model) View() string {
248 if m.width == 0 || m.suppressView {
249 // No WindowSizeMsg yet, or a width-resize mid-drag: an empty frame
250 // is safest. A 0-wide layout flashes garbled, and a real frame
251 // mid-drag races the renderer's stale-flush window.
252 return ""
253 }
254 var pieces []string
255 if m.streaming.Len() > 0 {
256 pieces = append(pieces, ansi.Wrap(m.streaming.String(), m.width, ""))
257 }
258 if q := m.renderQueued(); q != "" {
259 pieces = append(pieces, q)
260 }
261 if p := m.renderPopover(); p != "" {
262 pieces = append(pieces, p)
263 }
264 // Divider one cell narrower than m.width, and pieces joined with bare
265 // "\n" (not lipgloss.JoinVertical's Left-pad): a line ending in the last
266 // column trips Apple Terminal.app's last-column-wrap (DECAWM xn)
267 // inconsistently, drifting bubbletea's inline line count by one per frame:
268 // a duplicated prompt line overwrites the status bar on macOS (other
269 // terminals stay clean). Keeping the last column blank sidesteps it.
270 pieces = append(pieces,
271 styleDim.Render(strings.Repeat("─", max(m.width-1, 1))),
272 m.ta.View(),

Calls 4

renderQueuedMethod · 0.95
renderPopoverMethod · 0.95
renderStatusBarMethod · 0.95
StringMethod · 0.80