newPromptInput builds the configured textarea and chip bookkeeping. All styling lives here so model.go never touches textarea internals directly.
()
| 56 | // newPromptInput builds the configured textarea and chip bookkeeping. All |
| 57 | // styling lives here so model.go never touches textarea internals directly. |
| 58 | func newPromptInput() promptInput { |
| 59 | ta := textarea.New() |
| 60 | ta.Placeholder = "Ask codehamr. / or Tab for commands · Ctrl+C cancels" |
| 61 | ta.Focus() |
| 62 | ta.CharLimit = 0 |
| 63 | ta.MaxHeight = 0 // 0 = unbounded; recomputeLayout enforces the cap |
| 64 | ta.ShowLineNumbers = false |
| 65 | ta.SetHeight(1) |
| 66 | ta.SetWidth(defaultWidth - 2) |
| 67 | ta.Prompt = "▌ " |
| 68 | |
| 69 | bare := lipgloss.NewStyle() |
| 70 | ta.FocusedStyle.Base = bare |
| 71 | ta.FocusedStyle.CursorLine = bare |
| 72 | ta.FocusedStyle.CursorLineNumber = bare |
| 73 | ta.FocusedStyle.EndOfBuffer = bare |
| 74 | ta.FocusedStyle.LineNumber = bare |
| 75 | ta.FocusedStyle.Placeholder = styleDim |
| 76 | ta.FocusedStyle.Prompt = stylePrompt |
| 77 | ta.FocusedStyle.Text = bare |
| 78 | ta.BlurredStyle = ta.FocusedStyle |
| 79 | ta.Cursor.Style = styleHamr |
| 80 | |
| 81 | return promptInput{ |
| 82 | ta: ta, |
| 83 | store: map[int]chipContent{}, |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | // chipLabel is the visible form inserted into the textarea. Plain text, no |
| 88 | // ANSI, since textarea doesn't render inline styling inside its value. |