package main import ( "github.com/charmbracelet/bubbles/textinput" tea "github.com/charmbracelet/bubbletea" "github.com/charmbracelet/lipgloss" ) // NewInput creates a configured text input for message composition. func NewInput() textinput.Model { ti := textinput.New() ti.Placeholder = "Type a message..." ti.Focus() ti.CharLimit = 4000 ti.Width = 60 ti.PromptStyle = lipgloss.NewStyle().Foreground(aqua).Bold(true) ti.TextStyle = lipgloss.NewStyle().Foreground(fg) ti.Cursor.Style = lipgloss.NewStyle().Foreground(aqua) ti.PlaceholderStyle = lipgloss.NewStyle().Foreground(fgF) return ti } // InputUpdate handles key events for the input when focused. func InputUpdate(input textinput.Model, msg tea.KeyMsg) (textinput.Model, tea.Cmd) { switch msg.String() { case "enter": // Send message - handled by parent model return input, nil case "esc": // Unfocus - handled by parent model return input, nil } var cmd tea.Cmd input, cmd = input.Update(msg) return input, cmd }