summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2025-08-30 10:56:00 -0500
committerGitHub <[email protected]>2025-08-30 10:56:00 -0500
commitdac821229eba42d8680895db068c3ce1632d046c (patch)
tree84dd9ea9d7433d2a64b7821b9a867e300879cbfa
parent3625766ad4d7e96d4cecfe4adbe13dd2c407df63 (diff)
downloadopencode-dac821229eba42d8680895db068c3ce1632d046c.tar.gz
opencode-dac821229eba42d8680895db068c3ce1632d046c.zip
fix: resolve [pasted lines] when passing paste as arguments for command (#2333)
-rw-r--r--packages/tui/internal/components/chat/editor.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/packages/tui/internal/components/chat/editor.go b/packages/tui/internal/components/chat/editor.go
index 0c52ca84c..710049707 100644
--- a/packages/tui/internal/components/chat/editor.go
+++ b/packages/tui/internal/components/chat/editor.go
@@ -489,11 +489,22 @@ func (m *editorComponent) Submit() (tea.Model, tea.Cmd) {
var cmds []tea.Cmd
if strings.HasPrefix(value, "/") {
- value = value[1:]
- commandName := strings.Split(value, " ")[0]
+ // Expand attachments in the value to get actual content
+ expandedValue := value
+ attachments := m.textarea.GetAttachments()
+ for _, att := range attachments {
+ if att.Type == "text" && att.Source != nil {
+ if textSource, ok := att.Source.(*attachment.TextSource); ok {
+ expandedValue = strings.Replace(expandedValue, att.Display, textSource.Value, 1)
+ }
+ }
+ }
+
+ expandedValue = expandedValue[1:] // Remove the "/"
+ commandName := strings.Split(expandedValue, " ")[0]
command := m.app.Commands[commands.CommandName(commandName)]
if command.Custom {
- args := strings.TrimPrefix(value, command.PrimaryTrigger()+" ")
+ args := strings.TrimPrefix(expandedValue, command.PrimaryTrigger()+" ")
cmds = append(
cmds,
util.CmdHandler(app.SendCommand{Command: string(command.Name), Args: args}),