@@ -67,7 +67,7 @@ const (
6767 maxAttachments = 5
6868)
6969
70−func (m *editorCmp) openEditor() tea.Cmd {
70+func (m *editorCmp) openEditor(value string) tea.Cmd {
7171 editor := os.Getenv("EDITOR")
7272 if editor == "" {
7373 // Use platform-appropriate default editor
@@ -82,6 +82,7 @@ func (m *editorCmp) openEditor() tea.Cmd {
8282 if err != nil {
8383 return util.ReportError(err)
8484 }
85+ _, _ = tmpfile.WriteString(value)
8586 tmpfile.Close()
8687 c := exec.Command(editor, tmpfile.Name())
8788 c.Stdin = os.Stdin
@@ -239,7 +240,7 @@ func (m *editorCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
239240 if m.app.CoderAgent.IsSessionBusy(m.session.ID) {
240241 return m, util.ReportWarn("Agent is working, please wait...")
241242 }
242− return m, m.openEditor()
243+ return m, m.openEditor(m.textarea.Value())
243244 }
244245 if key.Matches(msg, DeleteKeyMaps.Escape) {
245246 m.deleteMode = false