@@ -67,6 +67,10 @@ const (
6767 maxAttachments = 5
6868)
6969
70+type openEditorMsg struct {
71+ Text string
72+}
73+
7074func (m *editorCmp) openEditor(value string) tea.Cmd {
7175 editor := os.Getenv("EDITOR")
7276 if editor == "" {
@@ -102,11 +106,8 @@ func (m *editorCmp) openEditor(value string) tea.Cmd {
102106 return util.ReportWarn("Message is empty")
103107 }
104108 os.Remove(tmpfile.Name())
105− attachments := m.attachments
106− m.attachments = nil
107− return chat.SendMsg{
108− Text: string(content),
109− Attachments: attachments,
109+ return openEditorMsg{
110+ Text: strings.TrimSpace(string(content)),
110111 }
111112 })
112113}
@@ -184,6 +185,9 @@ func (m *editorCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
184185 m.completionsStartIndex = 0
185186 return m, nil
186187 }
188+ case openEditorMsg:
189+ m.textarea.SetValue(msg.Text)
190+ return m, nil
187191 case tea.KeyPressMsg:
188192 switch {
189193 // Completions