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

Method Value

internal/tui/prompt.go:471–495  ·  view source on GitHub ↗

Value returns the prompt text with every chip label expanded to its original content, what goes to the LLM on submit.

()

Source from the content-addressed store, hash-verified

469// Value returns the prompt text with every chip label expanded to its original
470// content, what goes to the LLM on submit.
471func (p promptInput) Value() string {
472 if len(p.spans) == 0 {
473 return p.ta.Value()
474 }
475 value := p.ta.Value()
476 runes := []rune(value)
477 var b strings.Builder
478 b.Grow(len(value))
479 cursor := 0
480 for _, span := range p.spans {
481 content, ok := p.store[span.id]
482 if !ok {
483 continue
484 }
485 if span.start > cursor {
486 b.WriteString(string(runes[cursor:span.start]))
487 }
488 b.WriteString(content.content)
489 cursor = span.end
490 }
491 if cursor < len(runes) {
492 b.WriteString(string(runes[cursor:]))
493 }
494 return b.String()
495}
496
497// DisplayValue returns the text as shown, chip labels stay collapsed. Used for
498// echo-to-scroll on submit and the ↑/↓ history snapshot.

Callers 15

abortTurnMethod · 0.80
deleteSpanMethod · 0.80
reconcileMethod · 0.80
cursorRuneOffsetMethod · 0.80
setCursorRuneOffsetMethod · 0.80
DisplayValueMethod · 0.80
EntryMethod · 0.80
handleKeyMethod · 0.80
handleTabMethod · 0.80
handleEscInPopoverMethod · 0.80
handleEnterMethod · 0.80
queuePromptMethod · 0.80

Calls 1

StringMethod · 0.80