chore: fix editor

This commit is contained in:
Kujtim Hoxha
2025-07-25 17:13:50 +02:00
parent ef28817d42
commit d4b5306536
2 changed files with 7 additions and 3 deletions

View File

@@ -80,7 +80,7 @@ const (
maxAttachments = 5
)
type openEditorMsg struct {
type OpenEditorMsg struct {
Text string
}
@@ -119,7 +119,7 @@ func (m *editorCmp) openEditor(value string) tea.Cmd {
return util.ReportWarn("Message is empty")
}
os.Remove(tmpfile.Name())
return openEditorMsg{
return OpenEditorMsg{
Text: strings.TrimSpace(string(content)),
}
})
@@ -204,7 +204,7 @@ func (m *editorCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.completionsStartIndex = 0
}
}
case openEditorMsg:
case OpenEditorMsg:
m.textarea.SetValue(msg.Text)
m.textarea.MoveToEnd()
case tea.KeyPressMsg:

View File

@@ -179,6 +179,10 @@ func (p *chatPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case CancelTimerExpiredMsg:
p.isCanceling = false
return p, nil
case editor.OpenEditorMsg:
u, cmd := p.editor.Update(msg)
p.editor = u.(editor.Editor)
return p, cmd
case chat.SendMsg:
return p, p.sendMessage(msg.Text, msg.Attachments)
case chat.SessionSelectedMsg: