From e87b41e56ca5d6dcecac65b1f96a697bd54a6ad1 Mon Sep 17 00:00:00 2001 From: hems Date: Sat, 26 Jul 2025 17:24:09 +0100 Subject: [PATCH] apparently making a function public --- internal/tui/components/chat/editor/editor.go | 10 ++++------ internal/tui/page/chat/chat.go | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/internal/tui/components/chat/editor/editor.go b/internal/tui/components/chat/editor/editor.go index 33150955f36e8f4f86dad140bad8e53f46d08fe8..9f03cb8cdc2c4949a50a62df7cfb729b0b5c48a1 100644 --- a/internal/tui/components/chat/editor/editor.go +++ b/internal/tui/components/chat/editor/editor.go @@ -37,7 +37,7 @@ type Editor interface { SetSession(session session.Session) tea.Cmd IsCompletionsOpen() bool Cursor() *tea.Cursor - SendMessage() tea.Cmd + Send() tea.Cmd } type FileCompletionItem struct { @@ -130,7 +130,7 @@ func (m *editorCmp) Init() tea.Cmd { return nil } -func (m *editorCmp) send() tea.Cmd { +func (m *editorCmp) Send() tea.Cmd { if m.app.CoderAgent == nil { return util.ReportError(fmt.Errorf("coder agent is not initialized")) } @@ -267,7 +267,7 @@ func (m *editorCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.textarea.SetValue(value[:len(value)-1]) } else { // Otherwise, send the message - return m, m.send() + return m, m.Send() } } } @@ -443,9 +443,7 @@ func (c *editorCmp) IsCompletionsOpen() bool { return c.isCompletionsOpen } -func (c *editorCmp) SendMessage() tea.Cmd { - return c.send() -} + func New(app *app.App, initialPrompt string) Editor { t := styles.CurrentTheme() diff --git a/internal/tui/page/chat/chat.go b/internal/tui/page/chat/chat.go index 80a3b8586f4bfd634cf9d0f5b8dd58b5428b878b..796210f0fdde538398c646a960a9b273ca985931 100644 --- a/internal/tui/page/chat/chat.go +++ b/internal/tui/page/chat/chat.go @@ -165,7 +165,7 @@ func (p *chatPage) Init() tea.Cmd { // If we have an initial prompt, automatically send it if p.initialPrompt != "" { - cmds = append(cmds, p.editor.SendMessage()) + cmds = append(cmds, p.editor.Send()) } } @@ -295,7 +295,7 @@ func (p *chatPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) { // If we have an initial prompt, automatically send it after onboarding completes if p.initialPrompt != "" { - return p, tea.Batch(p.SetSize(p.width, p.height), p.editor.SendMessage()) + return p, tea.Batch(p.SetSize(p.width, p.height), p.editor.Send()) } return p, p.SetSize(p.width, p.height)