diff options
| author | Aiden Cline <[email protected]> | 2025-07-19 12:02:24 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-19 12:02:24 -0500 |
| commit | 97d9c851e6725833f8edcec1e606a281609dbd74 (patch) | |
| tree | b8debed1a487fb99631239495abe16831d994eaa | |
| parent | 76bd70299231a69a9dd0eed656f9dce1fdc3a3f7 (diff) | |
| download | opencode-97d9c851e6725833f8edcec1e606a281609dbd74.tar.gz opencode-97d9c851e6725833f8edcec1e606a281609dbd74.zip | |
fix: escape ansi sequences (#1139)
| -rw-r--r-- | packages/tui/go.mod | 2 | ||||
| -rw-r--r-- | packages/tui/internal/components/chat/message.go | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/packages/tui/go.mod b/packages/tui/go.mod index f2ad0c56c..e23e05c30 100644 --- a/packages/tui/go.mod +++ b/packages/tui/go.mod @@ -10,7 +10,6 @@ require ( github.com/charmbracelet/glamour v0.10.0 github.com/charmbracelet/lipgloss/v2 v2.0.0-beta.3 github.com/charmbracelet/x/ansi v0.9.3 - github.com/charmbracelet/x/input v0.3.7 github.com/google/uuid v1.6.0 github.com/lithammer/fuzzysearch v1.1.8 github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 @@ -34,6 +33,7 @@ require ( github.com/atombender/go-jsonschema v0.20.0 // indirect github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834 // indirect github.com/charmbracelet/x/exp/slice v0.0.0-20250327172914-2fdc97757edf // indirect + github.com/charmbracelet/x/input v0.3.7 // indirect github.com/charmbracelet/x/windows v0.2.1 // indirect github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect github.com/fsnotify/fsnotify v1.8.0 // indirect diff --git a/packages/tui/internal/components/chat/message.go b/packages/tui/internal/components/chat/message.go index ef097c09c..6199e9bf2 100644 --- a/packages/tui/internal/components/chat/message.go +++ b/packages/tui/internal/components/chat/message.go @@ -378,7 +378,8 @@ func renderToolDetails( stdout := metadata["stdout"] if stdout != nil { command := toolInputMap["command"].(string) - body = fmt.Sprintf("```console\n> %s\n%s```", command, stdout) + out := ansi.Strip(fmt.Sprintf("%s", stdout)) + body = fmt.Sprintf("```console\n> %s\n%s```", command, out) body = util.ToMarkdown(body, width, backgroundColor) } case "webfetch": |
