diff options
| author | adamdottv <[email protected]> | 2025-06-16 11:53:06 -0500 |
|---|---|---|
| committer | adamdottv <[email protected]> | 2025-06-16 11:54:55 -0500 |
| commit | 7c0d10a4cec17d4cb2e04793c56363f2e746278b (patch) | |
| tree | dd1fef7560a8bdb7803e40e1fa31ab51d7134bad /packages/tui/internal/components | |
| parent | 06af4061469b584744e4a976999bb7a55885c15d (diff) | |
| download | opencode-7c0d10a4cec17d4cb2e04793c56363f2e746278b.tar.gz opencode-7c0d10a4cec17d4cb2e04793c56363f2e746278b.zip | |
feat: faster tui init
Diffstat (limited to 'packages/tui/internal/components')
| -rw-r--r-- | packages/tui/internal/components/chat/message.go | 4 | ||||
| -rw-r--r-- | packages/tui/internal/components/chat/messages.go | 4 | ||||
| -rw-r--r-- | packages/tui/internal/components/core/status.go | 8 |
3 files changed, 8 insertions, 8 deletions
diff --git a/packages/tui/internal/components/chat/message.go b/packages/tui/internal/components/chat/message.go index 1f9f8ca59..17d643f5b 100644 --- a/packages/tui/internal/components/chat/message.go +++ b/packages/tui/internal/components/chat/message.go @@ -23,7 +23,7 @@ import ( func toMarkdown(content string, width int, backgroundColor compat.AdaptiveColor) string { r := styles.GetMarkdownRenderer(width, backgroundColor) - content = strings.ReplaceAll(content, app.Info.Path.Root+"/", "") + content = strings.ReplaceAll(content, app.RootPath+"/", "") rendered, _ := r.Render(content) lines := strings.Split(rendered, "\n") @@ -584,7 +584,7 @@ func truncateHeight(content string, height int) string { } func relative(path string) string { - return strings.TrimPrefix(path, app.Info.Path.Root+"/") + return strings.TrimPrefix(path, app.RootPath+"/") } func extension(path string) string { diff --git a/packages/tui/internal/components/chat/messages.go b/packages/tui/internal/components/chat/messages.go index 487e14a11..b59f96761 100644 --- a/packages/tui/internal/components/chat/messages.go +++ b/packages/tui/internal/components/chat/messages.go @@ -139,7 +139,7 @@ func (m *messagesComponent) renderView() { author := "" switch message.Role { case client.User: - author = app.Info.User + author = m.app.Info.User case client.Assistant: author = message.Metadata.Assistant.ModelID } @@ -328,7 +328,7 @@ func (m *messagesComponent) home() string { logoAndVersion := lipgloss.JoinVertical( lipgloss.Right, logo, - muted(app.Info.Version), + muted(m.app.Version), ) lines := []string{} diff --git a/packages/tui/internal/components/core/status.go b/packages/tui/internal/components/core/status.go index d014d6fa3..e9b913642 100644 --- a/packages/tui/internal/components/core/status.go +++ b/packages/tui/internal/components/core/status.go @@ -34,14 +34,14 @@ func (m statusComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, nil } -func logo() string { +func (m statusComponent) logo() string { t := theme.CurrentTheme() base := lipgloss.NewStyle().Background(t.BackgroundElement()).Foreground(t.TextMuted()).Render emphasis := lipgloss.NewStyle().Bold(true).Background(t.BackgroundElement()).Foreground(t.Text()).Render open := base("open") code := emphasis("code ") - version := base(app.Info.Version) + version := base(m.app.Version) return styles.Padded(). Background(t.BackgroundElement()). Render(open + code + version) @@ -84,12 +84,12 @@ func (m statusComponent) View() string { Render("") } - logo := logo() + logo := m.logo() cwd := styles.Padded(). Foreground(t.TextMuted()). Background(t.BackgroundSubtle()). - Render(app.Info.Path.Cwd) + Render(m.app.Info.Path.Cwd) sessionInfo := "" if m.app.Session.Id != "" { |
