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.go12
-rw-r--r--packages/tui/internal/components/chat/messages.go21
-rw-r--r--packages/tui/internal/components/commands/commands.go3
3 files changed, 22 insertions, 14 deletions
diff --git a/packages/tui/internal/components/chat/editor.go b/packages/tui/internal/components/chat/editor.go
index 0ac3978a8..57dcbf154 100644
--- a/packages/tui/internal/components/chat/editor.go
+++ b/packages/tui/internal/components/chat/editor.go
@@ -22,7 +22,7 @@ import (
type EditorComponent interface {
tea.Model
tea.ViewModel
- layout.Sizeable
+ SetSize(width, height int) tea.Cmd
Content() string
Lines() int
Value() string
@@ -158,7 +158,15 @@ func (m *editorComponent) Content() string {
func (m *editorComponent) View() string {
if m.Lines() > 1 {
- return ""
+ t := theme.CurrentTheme()
+ return lipgloss.Place(
+ m.width,
+ m.height,
+ lipgloss.Center,
+ lipgloss.Center,
+ "",
+ styles.WhitespaceStyle(t.Background()),
+ )
}
return m.Content()
}
diff --git a/packages/tui/internal/components/chat/messages.go b/packages/tui/internal/components/chat/messages.go
index 0a1aaa8f8..ab9ef65ec 100644
--- a/packages/tui/internal/components/chat/messages.go
+++ b/packages/tui/internal/components/chat/messages.go
@@ -21,6 +21,7 @@ import (
type MessagesComponent interface {
tea.Model
tea.ViewModel
+ SetSize(width, height int) tea.Cmd
PageUp() (tea.Model, tea.Cmd)
PageDown() (tea.Model, tea.Cmd)
HalfPageUp() (tea.Model, tea.Cmd)
@@ -311,6 +312,7 @@ func (m *messagesComponent) View() string {
if len(m.app.Messages) == 0 {
return m.home()
}
+ t := theme.CurrentTheme()
if m.rendering {
return lipgloss.Place(
m.width,
@@ -318,19 +320,18 @@ func (m *messagesComponent) View() string {
lipgloss.Center,
lipgloss.Center,
"Loading session...",
+ styles.WhitespaceStyle(t.Background()),
)
}
- t := theme.CurrentTheme()
- return lipgloss.JoinVertical(
- lipgloss.Left,
- lipgloss.PlaceHorizontal(
- m.width,
- lipgloss.Center,
- m.header(),
- styles.WhitespaceStyle(t.Background()),
- ),
- m.viewport.View(),
+ header := lipgloss.PlaceHorizontal(
+ m.width,
+ lipgloss.Center,
+ m.header(),
+ styles.WhitespaceStyle(t.Background()),
)
+ return styles.NewStyle().
+ Background(t.Background()).
+ Render(header + "\n" + m.viewport.View())
}
func (m *messagesComponent) home() string {
diff --git a/packages/tui/internal/components/commands/commands.go b/packages/tui/internal/components/commands/commands.go
index e20755575..68f6503e0 100644
--- a/packages/tui/internal/components/commands/commands.go
+++ b/packages/tui/internal/components/commands/commands.go
@@ -9,7 +9,6 @@ import (
"github.com/charmbracelet/lipgloss/v2/compat"
"github.com/sst/opencode/internal/app"
"github.com/sst/opencode/internal/commands"
- "github.com/sst/opencode/internal/layout"
"github.com/sst/opencode/internal/styles"
"github.com/sst/opencode/internal/theme"
)
@@ -17,7 +16,7 @@ import (
type CommandsComponent interface {
tea.Model
tea.ViewModel
- layout.Sizeable
+ SetSize(width, height int) tea.Cmd
SetBackgroundColor(color compat.AdaptiveColor)
}