MCPcopy Create free account
hub / github.com/IIIIQIIII/claude-code / renderPlaceholder

Function renderPlaceholder

src/hooks/renderPlaceholder.ts:13–51  ·  view source on GitHub ↗
({
  placeholder,
  value,
  showCursor,
  focus,
  terminalFocus = true,
  invert = chalk.inverse,
  hidePlaceholderText = false,
}: PlaceholderRendererProps)

Source from the content-addressed store, hash-verified

11}
12
13export function renderPlaceholder({
14 placeholder,
15 value,
16 showCursor,
17 focus,
18 terminalFocus = true,
19 invert = chalk.inverse,
20 hidePlaceholderText = false,
21}: PlaceholderRendererProps): {
22 renderedPlaceholder: string | undefined
23 showPlaceholder: boolean
24} {
25 let renderedPlaceholder: string | undefined = undefined
26
27 if (placeholder) {
28 if (hidePlaceholderText) {
29 // Voice recording: show only the cursor, no placeholder text
30 renderedPlaceholder =
31 showCursor && focus && terminalFocus ? invert(' ') : ''
32 } else {
33 renderedPlaceholder = chalk.dim(placeholder)
34
35 // Show inverse cursor only when both input and terminal are focused
36 if (showCursor && focus && terminalFocus) {
37 renderedPlaceholder =
38 placeholder.length > 0
39 ? invert(placeholder[0]!) + chalk.dim(placeholder.slice(1))
40 : invert(' ')
41 }
42 }
43 }
44
45 const showPlaceholder = value.length === 0 && Boolean(placeholder)
46
47 return {
48 renderedPlaceholder,
49 showPlaceholder,
50 }
51}

Callers 1

BaseTextInputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected