MCPcopy Create free account
hub / github.com/diillson/chatcli / clampSpinnerMessage

Function clampSpinnerMessage

cli/animation_manager.go:124–135  ·  view source on GitHub ↗

clampSpinnerMessage bounds msg so the rendered spinner line (message + "... " + glyph) never exceeds one terminal row. Rune-aware so multibyte labels (paths, queries, emoji) truncate cleanly.

(msg string, cols int)

Source from the content-addressed store, hash-verified

122// "... " + glyph) never exceeds one terminal row. Rune-aware so multibyte
123// labels (paths, queries, emoji) truncate cleanly.
124func clampSpinnerMessage(msg string, cols int) string {
125 const reserved = 8 // "... " + glyph + right margin
126 limit := cols - reserved
127 if limit < 16 {
128 limit = 16
129 }
130 r := []rune(msg)
131 if len(r) <= limit {
132 return msg
133 }
134 return string(r[:limit-1]) + "…"
135}
136
137// UpdateMessage atualiza a mensagem sem parar e reiniciar a animação
138func (am *AnimationManager) UpdateMessage(message string) {

Callers 2

ShowThinkingAnimationMethod · 0.85
TestClampSpinnerMessageFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestClampSpinnerMessageFunction · 0.68