fix: messages layout instability

This commit is contained in:
adamdotdevin
2025-08-13 11:43:28 -05:00
parent f2021a85d6
commit 66d99ba527
2 changed files with 2 additions and 60 deletions

View File

@@ -183,6 +183,8 @@ func renderContentBlock(
if renderer.borderRight {
style = style.BorderRightForeground(borderColor)
}
} else {
style = style.PaddingLeft(renderer.paddingLeft + 1).PaddingRight(renderer.paddingRight + 1)
}
content = style.Render(content)

View File

@@ -386,12 +386,6 @@ func (m *messagesComponent) renderView() tea.Cmd {
fileParts,
agentParts,
)
content = lipgloss.PlaceHorizontal(
m.width,
lipgloss.Center,
content,
styles.WhitespaceStyle(t.Background()),
)
m.cache.Set(key, content)
}
if content != "" {
@@ -468,12 +462,6 @@ func (m *messagesComponent) renderView() tea.Cmd {
[]opencode.AgentPart{},
toolCallParts...,
)
content = lipgloss.PlaceHorizontal(
m.width,
lipgloss.Center,
content,
styles.WhitespaceStyle(t.Background()),
)
m.cache.Set(key, content)
}
} else {
@@ -490,12 +478,6 @@ func (m *messagesComponent) renderView() tea.Cmd {
[]opencode.AgentPart{},
toolCallParts...,
)
content = lipgloss.PlaceHorizontal(
m.width,
lipgloss.Center,
content,
styles.WhitespaceStyle(t.Background()),
)
}
if content != "" {
partCount++
@@ -536,12 +518,6 @@ func (m *messagesComponent) renderView() tea.Cmd {
permission,
width,
)
content = lipgloss.PlaceHorizontal(
m.width,
lipgloss.Center,
content,
styles.WhitespaceStyle(t.Background()),
)
m.cache.Set(key, content)
}
} else {
@@ -552,12 +528,6 @@ func (m *messagesComponent) renderView() tea.Cmd {
permission,
width,
)
content = lipgloss.PlaceHorizontal(
m.width,
lipgloss.Center,
content,
styles.WhitespaceStyle(t.Background()),
)
}
if content != "" {
partCount++
@@ -586,12 +556,6 @@ func (m *messagesComponent) renderView() tea.Cmd {
[]opencode.FilePart{},
[]opencode.AgentPart{},
)
content = lipgloss.PlaceHorizontal(
m.width,
lipgloss.Center,
content,
styles.WhitespaceStyle(t.Background()),
)
partCount++
lineCount += lipgloss.Height(content) + 1
blocks = append(blocks, content)
@@ -625,12 +589,6 @@ func (m *messagesComponent) renderView() tea.Cmd {
[]opencode.FilePart{},
[]opencode.AgentPart{},
)
content = lipgloss.PlaceHorizontal(
m.width,
lipgloss.Center,
content,
styles.WhitespaceStyle(t.Background()),
)
partCount++
lineCount += lipgloss.Height(content) + 1
blocks = append(blocks, content)
@@ -645,12 +603,6 @@ func (m *messagesComponent) renderView() tea.Cmd {
width,
WithBorderColor(t.Error()),
)
error = lipgloss.PlaceHorizontal(
m.width,
lipgloss.Center,
error,
styles.WhitespaceStyle(t.Background()),
)
blocks = append(blocks, error)
lineCount += lipgloss.Height(error) + 1
}
@@ -742,12 +694,6 @@ func (m *messagesComponent) renderView() tea.Cmd {
m.app.CurrentPermission,
width,
)
content = lipgloss.PlaceHorizontal(
m.width,
lipgloss.Center,
content,
styles.WhitespaceStyle(t.Background()),
)
if content != "" {
partCount++
lineCount += lipgloss.Height(content) + 1
@@ -916,12 +862,6 @@ func (m *messagesComponent) renderHeader() string {
BorderForeground(t.BackgroundElement()).
BorderStyle(lipgloss.ThickBorder()).
Render(header)
header = lipgloss.PlaceHorizontal(
m.width,
lipgloss.Center,
header,
styles.WhitespaceStyle(t.Background()),
)
return "\n" + header + "\n"
}