diff options
| author | adamdotdevin <[email protected]> | 2025-07-16 12:42:52 -0500 |
|---|---|---|
| committer | adamdotdevin <[email protected]> | 2025-07-16 12:43:02 -0500 |
| commit | cdc1d8a94d12a31d5d162cb37744305738177ac2 (patch) | |
| tree | a9a9494ddc5b4a1a30c28e9ef19c99541292e630 /packages/tui/internal/components/chat/message.go | |
| parent | fdd6d6600f090ad4f15b2bbfc0bb75c36a722f4e (diff) | |
| download | opencode-cdc1d8a94d12a31d5d162cb37744305738177ac2.tar.gz opencode-cdc1d8a94d12a31d5d162cb37744305738177ac2.zip | |
feat(tui): layout config to render full width
Diffstat (limited to 'packages/tui/internal/components/chat/message.go')
| -rw-r--r-- | packages/tui/internal/components/chat/message.go | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/packages/tui/internal/components/chat/message.go b/packages/tui/internal/components/chat/message.go index 35ff675bd..d3263b053 100644 --- a/packages/tui/internal/components/chat/message.go +++ b/packages/tui/internal/components/chat/message.go @@ -10,6 +10,7 @@ import ( "github.com/charmbracelet/lipgloss/v2" "github.com/charmbracelet/lipgloss/v2/compat" "github.com/charmbracelet/x/ansi" + "github.com/muesli/reflow/truncate" "github.com/sst/opencode-sdk-go" "github.com/sst/opencode/internal/app" "github.com/sst/opencode/internal/components/diff" @@ -319,11 +320,19 @@ func renderToolDetails( if diffField != nil { patch := diffField.(string) var formattedDiff string - formattedDiff, _ = diff.FormatUnifiedDiff( - filename, - patch, - diff.WithWidth(width-2), - ) + if width < 120 { + formattedDiff, _ = diff.FormatUnifiedDiff( + filename, + patch, + diff.WithWidth(width-2), + ) + } else { + formattedDiff, _ = diff.FormatDiff( + filename, + patch, + diff.WithWidth(width-2), + ) + } body = strings.TrimSpace(formattedDiff) style := styles.NewStyle(). Background(backgroundColor). @@ -551,6 +560,8 @@ func renderToolTitle( toolName := renderToolName(toolCall.Tool) title = fmt.Sprintf("%s %s", toolName, toolArgs) } + + title = truncate.StringWithTail(title, uint(width-6), "...") return title } |
