summaryrefslogtreecommitdiffhomepage
path: root/packages/tui/internal/components
diff options
context:
space:
mode:
Diffstat (limited to 'packages/tui/internal/components')
-rw-r--r--packages/tui/internal/components/chat/editor.go23
-rw-r--r--packages/tui/internal/components/chat/messages.go17
2 files changed, 17 insertions, 23 deletions
diff --git a/packages/tui/internal/components/chat/editor.go b/packages/tui/internal/components/chat/editor.go
index 687553342..ef129765f 100644
--- a/packages/tui/internal/components/chat/editor.go
+++ b/packages/tui/internal/components/chat/editor.go
@@ -64,10 +64,7 @@ func (m *editorComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.WindowSizeMsg:
- m.width = min(msg.Width-4, app.MAX_CONTAINER_WIDTH)
- if m.app.Config.Layout == opencode.LayoutConfigStretch {
- m.width = msg.Width - 4
- }
+ m.width = msg.Width - 4
return m, nil
case spinner.TickMsg:
m.spinner, cmd = m.spinner.Update(msg)
@@ -180,6 +177,11 @@ func (m *editorComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
func (m *editorComponent) Content() string {
+ width := m.width
+ if m.app.Session.ID == "" {
+ width = min(width, 80)
+ }
+
t := theme.CurrentTheme()
base := styles.NewStyle().Foreground(t.Text()).Background(t.Background()).Render
muted := styles.NewStyle().Foreground(t.TextMuted()).Background(t.Background()).Render
@@ -188,7 +190,7 @@ func (m *editorComponent) Content() string {
Bold(true)
prompt := promptStyle.Render(">")
- m.textarea.SetWidth(m.width - 6)
+ m.textarea.SetWidth(width - 6)
textarea := lipgloss.JoinHorizontal(
lipgloss.Top,
prompt,
@@ -200,7 +202,7 @@ func (m *editorComponent) Content() string {
}
textarea = styles.NewStyle().
Background(t.BackgroundElement()).
- Width(m.width).
+ Width(width).
PaddingTop(1).
PaddingBottom(1).
BorderStyle(lipgloss.ThickBorder()).
@@ -236,7 +238,7 @@ func (m *editorComponent) Content() string {
model = muted(m.app.Provider.Name) + base(" "+m.app.Model.Name)
}
- space := m.width - 2 - lipgloss.Width(model) - lipgloss.Width(hint)
+ space := width - 2 - lipgloss.Width(model) - lipgloss.Width(hint)
spacer := styles.NewStyle().Background(t.Background()).Width(space).Render("")
info := hint + spacer + model
@@ -247,9 +249,14 @@ func (m *editorComponent) Content() string {
}
func (m *editorComponent) View() string {
+ width := m.width
+ if m.app.Session.ID == "" {
+ width = min(width, 80)
+ }
+
if m.Lines() > 1 {
return lipgloss.Place(
- m.width,
+ width,
5,
lipgloss.Center,
lipgloss.Center,
diff --git a/packages/tui/internal/components/chat/messages.go b/packages/tui/internal/components/chat/messages.go
index bf0c4d8f6..acc7b8879 100644
--- a/packages/tui/internal/components/chat/messages.go
+++ b/packages/tui/internal/components/chat/messages.go
@@ -146,10 +146,7 @@ func (m *messagesComponent) renderView() tea.Cmd {
orphanedToolCalls := make([]opencode.ToolPart, 0)
- width := min(m.width, app.MAX_CONTAINER_WIDTH)
- if m.app.Config.Layout == opencode.LayoutConfigStretch {
- width = m.width
- }
+ width := m.width // always use full width
for _, message := range m.app.Messages {
var content string
@@ -320,13 +317,6 @@ func (m *messagesComponent) renderView() tea.Cmd {
continue
}
- width := width
- if m.app.Config.Layout == opencode.LayoutConfigAuto &&
- part.Tool == "edit" &&
- part.State.Error == "" {
- width = min(m.width, app.EDIT_DIFF_MAX_WIDTH)
- }
-
if part.State.Status == opencode.ToolPartStateStatusCompleted || part.State.Status == opencode.ToolPartStateStatusError {
key := m.cache.GenerateKey(casted.ID,
part.ID,
@@ -419,10 +409,7 @@ func (m *messagesComponent) renderHeader() string {
return ""
}
- headerWidth := min(m.width, app.MAX_CONTAINER_WIDTH)
- if m.app.Config.Layout == opencode.LayoutConfigStretch {
- headerWidth = m.width
- }
+ headerWidth := m.width
t := theme.CurrentTheme()
base := styles.NewStyle().Foreground(t.Text()).Background(t.Background()).Render