fix: focus textarea on init, use shift+enter for newlines
This commit is contained in:
parent
e43f5e3cf8
commit
9068f8a329
1 changed files with 5 additions and 3 deletions
|
|
@ -76,14 +76,16 @@ type Model struct {
|
||||||
// NewModel creates a new TUI model wired to the given agent loop
|
// NewModel creates a new TUI model wired to the given agent loop
|
||||||
func NewModel(agentLoop *agent.AgentLoop, sessionKey, modelName string) Model {
|
func NewModel(agentLoop *agent.AgentLoop, sessionKey, modelName string) Model {
|
||||||
ta := textarea.New()
|
ta := textarea.New()
|
||||||
ta.Placeholder = "Type a message... (Enter to send, Alt+Enter for newline)"
|
ta.Placeholder = "Type a message... (Enter to send, Shift+Enter for newline)"
|
||||||
ta.Prompt = "│ "
|
ta.Prompt = "│ "
|
||||||
ta.CharLimit = 0 // No limit
|
ta.CharLimit = 0 // No limit
|
||||||
ta.SetHeight(textareaHeight)
|
ta.SetHeight(textareaHeight)
|
||||||
ta.ShowLineNumbers = false
|
ta.ShowLineNumbers = false
|
||||||
|
|
||||||
// Enter sends, Alt+Enter inserts newline
|
// Enter sends, Shift+Enter inserts newline
|
||||||
ta.KeyMap.InsertNewline = key.NewBinding(key.WithKeys("alt+enter"))
|
ta.KeyMap.InsertNewline = key.NewBinding(key.WithKeys("shift+enter"))
|
||||||
|
|
||||||
|
ta.Focus()
|
||||||
|
|
||||||
ta.FocusedStyle.CursorLine = lipgloss.NewStyle()
|
ta.FocusedStyle.CursorLine = lipgloss.NewStyle()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue