summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYihui Khuu <[email protected]>2025-07-26 00:32:06 +1000
committerGitHub <[email protected]>2025-07-25 09:32:06 -0500
commit0795a577e0ee43cf7aefb13f4d152fed7c0d3d5b (patch)
tree727f3201f82c2716f9d41863959606d62bcc18ee
parent8e5607f9c0e73b32293b8ed24d822fbdf67eb594 (diff)
downloadopencode-0795a577e0ee43cf7aefb13f4d152fed7c0d3d5b.tar.gz
opencode-0795a577e0ee43cf7aefb13f4d152fed7c0d3d5b.zip
fix: header width to display header in one line when sharing disabled (#1310)
-rw-r--r--packages/tui/internal/components/chat/messages.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/packages/tui/internal/components/chat/messages.go b/packages/tui/internal/components/chat/messages.go
index 635d12b62..d2da2c609 100644
--- a/packages/tui/internal/components/chat/messages.go
+++ b/packages/tui/internal/components/chat/messages.go
@@ -670,15 +670,21 @@ func (m *messagesComponent) renderHeader() string {
isSubscriptionModel := m.app.Model != nil &&
m.app.Model.Cost.Input == 0 && m.app.Model.Cost.Output == 0
+ sessionInfoText := formatTokensAndCost(tokens, contextWindow, cost, isSubscriptionModel)
sessionInfo = styles.NewStyle().
Foreground(t.TextMuted()).
Background(t.Background()).
- Render(formatTokensAndCost(tokens, contextWindow, cost, isSubscriptionModel))
+ Render(sessionInfoText)
shareEnabled := m.app.Config.Share != opencode.ConfigShareDisabled
+ headerTextWidth := headerWidth
+ if !shareEnabled {
+ // +1 is to ensure there is always at least one space between header and session info
+ headerTextWidth -= len(sessionInfoText) + 1
+ }
headerText := util.ToMarkdown(
"# "+m.app.Session.Title,
- headerWidth,
+ headerTextWidth,
t.Background(),
)
@@ -705,11 +711,9 @@ func (m *messagesComponent) renderHeader() string {
items...,
)
- var headerLines []string
+ headerLines := []string{headerRow}
if shareEnabled {
headerLines = []string{headerText, headerRow}
- } else {
- headerLines = []string{headerRow}
}
header := strings.Join(headerLines, "\n")