@@ -67,6 +67,10 @@ const (
67 maxAttachments = 5
67 maxAttachments = 5
70+type openEditorMsg struct {
70func (m *editorCmp) openEditor(value string) tea.Cmd {
74func (m *editorCmp) openEditor(value string) tea.Cmd {
71 editor := os.Getenv("EDITOR")
75 editor := os.Getenv("EDITOR")
72 if editor == "" {
76 if editor == "" {
@@ -102,11 +106,8 @@ func (m *editorCmp) openEditor(value string) tea.Cmd {
102 return util.ReportWarn("Message is empty")
106 return util.ReportWarn("Message is empty")
104 os.Remove(tmpfile.Name())
108 os.Remove(tmpfile.Name())
105− attachments := m.attachments
109+ return openEditorMsg{
107− return chat.SendMsg{
108− Text: string(content),
110+ Text: strings.TrimSpace(string(content)),
109− Attachments: attachments,
@@ -184,6 +185,9 @@ func (m *editorCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
184 m.completionsStartIndex = 0
185 m.completionsStartIndex = 0
185 return m, nil
186 return m, nil
189+ m.textarea.SetValue(msg.Text)
187 case tea.KeyPressMsg:
191 case tea.KeyPressMsg:
189 // Completions
193 // Completions