diff options
| author | adamdottv <[email protected]> | 2025-07-08 08:08:53 -0500 |
|---|---|---|
| committer | adamdottv <[email protected]> | 2025-07-08 08:09:01 -0500 |
| commit | 662d022a4859ee1c004133559ee42c5f7044dda7 (patch) | |
| tree | 304b17deceb254d0d70d29e9d46e865b1c4868cf /packages/tui/internal/app | |
| parent | 9efef03919f99750277a7f15722c24d7c7958224 (diff) | |
| download | opencode-662d022a4859ee1c004133559ee42c5f7044dda7.tar.gz opencode-662d022a4859ee1c004133559ee42c5f7044dda7.zip | |
feat(tui): paste images and pdfs
Diffstat (limited to 'packages/tui/internal/app')
| -rw-r--r-- | packages/tui/internal/app/app.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/tui/internal/app/app.go b/packages/tui/internal/app/app.go index 08a999f14..237ee0fee 100644 --- a/packages/tui/internal/app/app.go +++ b/packages/tui/internal/app/app.go @@ -18,6 +18,7 @@ import ( "github.com/sst/opencode/internal/styles" "github.com/sst/opencode/internal/theme" "github.com/sst/opencode/internal/util" + "golang.design/x/clipboard" ) type App struct { @@ -146,6 +147,17 @@ func (a *App) Key(commandName commands.CommandName) string { return base(key) + muted(" "+command.Description) } +func (a *App) SetClipboard(text string) tea.Cmd { + var cmds []tea.Cmd + cmds = append(cmds, func() tea.Msg { + clipboard.Write(clipboard.FmtText, []byte(text)) + return nil + }) + // try to set the clipboard using OSC52 for terminals that support it + cmds = append(cmds, tea.SetClipboard(text)) + return tea.Sequence(cmds...) +} + func (a *App) InitializeProvider() tea.Cmd { providersResponse, err := a.Client.Config.Providers(context.Background()) if err != nil { |
