summaryrefslogtreecommitdiffhomepage
path: root/internal/tui/components/chat/editor.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/tui/components/chat/editor.go')
-rw-r--r--internal/tui/components/chat/editor.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/tui/components/chat/editor.go b/internal/tui/components/chat/editor.go
index dbe55e7f9..0b2c9abb8 100644
--- a/internal/tui/components/chat/editor.go
+++ b/internal/tui/components/chat/editor.go
@@ -5,6 +5,7 @@ import (
"os"
"os/exec"
"slices"
+ "strings"
"unicode"
"github.com/charmbracelet/bubbles/key"
@@ -148,6 +149,11 @@ func (m *editorCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case dialog.ThemeChangedMsg:
m.textarea = CreateTextArea(&m.textarea)
+ case dialog.CompletionSelectedMsg:
+ existingValue := m.textarea.Value()
+ modifiedValue := strings.Replace(existingValue, msg.SearchString, msg.CompletionValue, 1)
+
+ m.textarea.SetValue(modifiedValue)
return m, nil
case dialog.AttachmentAddedMsg:
if len(m.attachments) >= maxAttachments {