summaryrefslogtreecommitdiffhomepage
path: root/packages/tui/internal/components/chat/editor.go
diff options
context:
space:
mode:
authoradamdotdevin <[email protected]>2025-07-18 13:03:27 -0500
committeradamdotdevin <[email protected]>2025-07-18 13:03:27 -0500
commit611854e4b68a2bfa30b336c1fa5135765c593f0f (patch)
tree5a92d8f4fcfa092f5d162948c769dcc664a493b5 /packages/tui/internal/components/chat/editor.go
parentd56dec4ba7867670d9a7dae2a535d38d59f24efb (diff)
downloadopencode-611854e4b68a2bfa30b336c1fa5135765c593f0f.tar.gz
opencode-611854e4b68a2bfa30b336c1fa5135765c593f0f.zip
feat(tui): simpler layout, always stretched
Diffstat (limited to 'packages/tui/internal/components/chat/editor.go')
-rw-r--r--packages/tui/internal/components/chat/editor.go23
1 files changed, 15 insertions, 8 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,