queuePrompt stashes the textarea contents to auto-submit when the running turn finishes (see fireQueued), then clears the input so the next prompt can be typed. A second call appends newline-joined, so a multi-part instruction builds up in one slot and fires as a single turn. Empty input is a no-op,
()
| 265 | // (chips expanded), DisplayValue() the visible echo (chips collapsed), the same |
| 266 | // split submit uses. Slash text queues like any prompt and routes through submit |
| 267 | // when it fires. |
| 268 | func (m Model) queuePrompt() (tea.Model, tea.Cmd) { |
| 269 | send := strings.TrimSpace(m.ta.Value()) |
| 270 | echo := strings.TrimSpace(m.ta.DisplayValue()) |
| 271 | if send == "" { |
| 272 | return m, nil |
| 273 | } |
| 274 | if m.queued == nil { |
| 275 | m.queued = &queuedPrompt{send: send, echo: echo} |
| 276 | } else { |
| 277 | // Never newline-join across a slash boundary. The joined text either |
| 278 | // starts with "/" and fires as ONE slash command whose Fields-split |
| 279 | // swallows the appended prose as bogus args (a queued "/clear" plus a |
| 280 | // follow-up instruction wipes the conversation and silently drops the |
| 281 | // instruction), or it ships the slash line to the LLM as prose. Refuse |
| 282 | // the append and keep the draft in the textarea so nothing is lost. |
| 283 | if strings.HasPrefix(m.queued.send, "/") || strings.HasPrefix(send, "/") { |
| 284 | m.status = queueSlashHint |
| 285 | return m, nil |
| 286 | } |
| 287 | // A fresh pointer, not an in-place edit: Model is copied by value across |
| 288 | // bubbletea, so mutating *m.queued would also reach through the discarded |
| 289 | // prior copy that still aliases the same struct. |
| 290 | m.queued = &queuedPrompt{ |
| 291 | send: m.queued.send + "\n" + send, |
| 292 | echo: m.queued.echo + "\n" + echo, |
| 293 | } |
| 294 | } |
| 295 | m.ta.Reset() |
| 296 | m.closePopover() |
| 297 | return m, nil |
| 298 | } |
| 299 | |
| 300 | // unqueuePrompt pulls the queued prompt back into the textarea and clears the |
no test coverage detected