fix: messages layout instability
This commit is contained in:
@@ -183,6 +183,8 @@ func renderContentBlock(
|
|||||||
if renderer.borderRight {
|
if renderer.borderRight {
|
||||||
style = style.BorderRightForeground(borderColor)
|
style = style.BorderRightForeground(borderColor)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
style = style.PaddingLeft(renderer.paddingLeft + 1).PaddingRight(renderer.paddingRight + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
content = style.Render(content)
|
content = style.Render(content)
|
||||||
|
|||||||
@@ -386,12 +386,6 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
|||||||
fileParts,
|
fileParts,
|
||||||
agentParts,
|
agentParts,
|
||||||
)
|
)
|
||||||
content = lipgloss.PlaceHorizontal(
|
|
||||||
m.width,
|
|
||||||
lipgloss.Center,
|
|
||||||
content,
|
|
||||||
styles.WhitespaceStyle(t.Background()),
|
|
||||||
)
|
|
||||||
m.cache.Set(key, content)
|
m.cache.Set(key, content)
|
||||||
}
|
}
|
||||||
if content != "" {
|
if content != "" {
|
||||||
@@ -468,12 +462,6 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
|||||||
[]opencode.AgentPart{},
|
[]opencode.AgentPart{},
|
||||||
toolCallParts...,
|
toolCallParts...,
|
||||||
)
|
)
|
||||||
content = lipgloss.PlaceHorizontal(
|
|
||||||
m.width,
|
|
||||||
lipgloss.Center,
|
|
||||||
content,
|
|
||||||
styles.WhitespaceStyle(t.Background()),
|
|
||||||
)
|
|
||||||
m.cache.Set(key, content)
|
m.cache.Set(key, content)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -490,12 +478,6 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
|||||||
[]opencode.AgentPart{},
|
[]opencode.AgentPart{},
|
||||||
toolCallParts...,
|
toolCallParts...,
|
||||||
)
|
)
|
||||||
content = lipgloss.PlaceHorizontal(
|
|
||||||
m.width,
|
|
||||||
lipgloss.Center,
|
|
||||||
content,
|
|
||||||
styles.WhitespaceStyle(t.Background()),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
if content != "" {
|
if content != "" {
|
||||||
partCount++
|
partCount++
|
||||||
@@ -536,12 +518,6 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
|||||||
permission,
|
permission,
|
||||||
width,
|
width,
|
||||||
)
|
)
|
||||||
content = lipgloss.PlaceHorizontal(
|
|
||||||
m.width,
|
|
||||||
lipgloss.Center,
|
|
||||||
content,
|
|
||||||
styles.WhitespaceStyle(t.Background()),
|
|
||||||
)
|
|
||||||
m.cache.Set(key, content)
|
m.cache.Set(key, content)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -552,12 +528,6 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
|||||||
permission,
|
permission,
|
||||||
width,
|
width,
|
||||||
)
|
)
|
||||||
content = lipgloss.PlaceHorizontal(
|
|
||||||
m.width,
|
|
||||||
lipgloss.Center,
|
|
||||||
content,
|
|
||||||
styles.WhitespaceStyle(t.Background()),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
if content != "" {
|
if content != "" {
|
||||||
partCount++
|
partCount++
|
||||||
@@ -586,12 +556,6 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
|||||||
[]opencode.FilePart{},
|
[]opencode.FilePart{},
|
||||||
[]opencode.AgentPart{},
|
[]opencode.AgentPart{},
|
||||||
)
|
)
|
||||||
content = lipgloss.PlaceHorizontal(
|
|
||||||
m.width,
|
|
||||||
lipgloss.Center,
|
|
||||||
content,
|
|
||||||
styles.WhitespaceStyle(t.Background()),
|
|
||||||
)
|
|
||||||
partCount++
|
partCount++
|
||||||
lineCount += lipgloss.Height(content) + 1
|
lineCount += lipgloss.Height(content) + 1
|
||||||
blocks = append(blocks, content)
|
blocks = append(blocks, content)
|
||||||
@@ -625,12 +589,6 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
|||||||
[]opencode.FilePart{},
|
[]opencode.FilePart{},
|
||||||
[]opencode.AgentPart{},
|
[]opencode.AgentPart{},
|
||||||
)
|
)
|
||||||
content = lipgloss.PlaceHorizontal(
|
|
||||||
m.width,
|
|
||||||
lipgloss.Center,
|
|
||||||
content,
|
|
||||||
styles.WhitespaceStyle(t.Background()),
|
|
||||||
)
|
|
||||||
partCount++
|
partCount++
|
||||||
lineCount += lipgloss.Height(content) + 1
|
lineCount += lipgloss.Height(content) + 1
|
||||||
blocks = append(blocks, content)
|
blocks = append(blocks, content)
|
||||||
@@ -645,12 +603,6 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
|||||||
width,
|
width,
|
||||||
WithBorderColor(t.Error()),
|
WithBorderColor(t.Error()),
|
||||||
)
|
)
|
||||||
error = lipgloss.PlaceHorizontal(
|
|
||||||
m.width,
|
|
||||||
lipgloss.Center,
|
|
||||||
error,
|
|
||||||
styles.WhitespaceStyle(t.Background()),
|
|
||||||
)
|
|
||||||
blocks = append(blocks, error)
|
blocks = append(blocks, error)
|
||||||
lineCount += lipgloss.Height(error) + 1
|
lineCount += lipgloss.Height(error) + 1
|
||||||
}
|
}
|
||||||
@@ -742,12 +694,6 @@ func (m *messagesComponent) renderView() tea.Cmd {
|
|||||||
m.app.CurrentPermission,
|
m.app.CurrentPermission,
|
||||||
width,
|
width,
|
||||||
)
|
)
|
||||||
content = lipgloss.PlaceHorizontal(
|
|
||||||
m.width,
|
|
||||||
lipgloss.Center,
|
|
||||||
content,
|
|
||||||
styles.WhitespaceStyle(t.Background()),
|
|
||||||
)
|
|
||||||
if content != "" {
|
if content != "" {
|
||||||
partCount++
|
partCount++
|
||||||
lineCount += lipgloss.Height(content) + 1
|
lineCount += lipgloss.Height(content) + 1
|
||||||
@@ -916,12 +862,6 @@ func (m *messagesComponent) renderHeader() string {
|
|||||||
BorderForeground(t.BackgroundElement()).
|
BorderForeground(t.BackgroundElement()).
|
||||||
BorderStyle(lipgloss.ThickBorder()).
|
BorderStyle(lipgloss.ThickBorder()).
|
||||||
Render(header)
|
Render(header)
|
||||||
header = lipgloss.PlaceHorizontal(
|
|
||||||
m.width,
|
|
||||||
lipgloss.Center,
|
|
||||||
header,
|
|
||||||
styles.WhitespaceStyle(t.Background()),
|
|
||||||
)
|
|
||||||
|
|
||||||
return "\n" + header + "\n"
|
return "\n" + header + "\n"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user