summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTimo Clasen <[email protected]>2025-07-10 01:37:39 +0200
committerGitHub <[email protected]>2025-07-09 18:37:39 -0500
commitf22021187dec9b561d7dc02edf3f6e05775b215d (patch)
treec07df20d0c4b0b41159bdd11455c945ceaf6cb96
parentfebecc348a9cce54938a705886fe00c0b85232f9 (diff)
downloadopencode-f22021187dec9b561d7dc02edf3f6e05775b215d.tar.gz
opencode-f22021187dec9b561d7dc02edf3f6e05775b215d.zip
feat(tui): treat pasted text file paths as file references (#809)
-rw-r--r--packages/tui/internal/components/chat/editor.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/packages/tui/internal/components/chat/editor.go b/packages/tui/internal/components/chat/editor.go
index 6053c9c01..4f6249722 100644
--- a/packages/tui/internal/components/chat/editor.go
+++ b/packages/tui/internal/components/chat/editor.go
@@ -96,7 +96,16 @@ func (m *editorComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case ".pdf":
mediaType = "application/pdf"
default:
- mediaType = "text/plain"
+ attachment := &textarea.Attachment{
+ ID: uuid.NewString(),
+ Display: "@" + filePath,
+ URL: fmt.Sprintf("file://./%s", filePath),
+ Filename: filePath,
+ MediaType: "text/plain",
+ }
+ m.textarea.InsertAttachment(attachment)
+ m.textarea.InsertString(" ")
+ return m, nil
}
fileBytes, err := os.ReadFile(filePath)