fix: header visibility with bottom border and dynamic height
This commit is contained in:
parent
6cd0a8d021
commit
8619a7f35c
@ -267,16 +267,16 @@ func (m Model) View() string {
|
|||||||
|
|
||||||
rightWidth := 42
|
rightWidth := 42
|
||||||
leftWidth := m.width - rightWidth - 3
|
leftWidth := m.width - rightWidth - 3
|
||||||
headerHeight := 3
|
|
||||||
mainHeight := m.height - headerHeight - 1
|
header := m.renderHeader()
|
||||||
|
headerHeight := lipgloss.Height(header)
|
||||||
|
mainHeight := m.height - headerHeight
|
||||||
inputHeight := 5
|
inputHeight := 5
|
||||||
chatHeight := mainHeight - inputHeight
|
chatHeight := mainHeight - inputHeight
|
||||||
if chatHeight < 10 {
|
if chatHeight < 10 {
|
||||||
chatHeight = 10
|
chatHeight = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
header := m.renderHeader()
|
|
||||||
|
|
||||||
chatBox := boxStyle.Width(leftWidth).Height(chatHeight).Render(m.viewport.View())
|
chatBox := boxStyle.Width(leftWidth).Height(chatHeight).Render(m.viewport.View())
|
||||||
inputBox := boxStyle.Width(leftWidth).Render(m.textarea.View())
|
inputBox := boxStyle.Width(leftWidth).Render(m.textarea.View())
|
||||||
leftPanel := lipgloss.JoinVertical(lipgloss.Left, chatBox, inputBox)
|
leftPanel := lipgloss.JoinVertical(lipgloss.Left, chatBox, inputBox)
|
||||||
@ -307,9 +307,10 @@ func (m Model) renderHeader() string {
|
|||||||
title := titleStyle.Render("orca.agent ") + mutedStyle.Render(version)
|
title := titleStyle.Render("orca.agent ") + mutedStyle.Render(version)
|
||||||
return lipgloss.NewStyle().
|
return lipgloss.NewStyle().
|
||||||
Width(m.width).
|
Width(m.width).
|
||||||
Height(1).
|
|
||||||
Padding(0, 1).
|
Padding(0, 1).
|
||||||
Background(lipgloss.Color(colors.bg)).
|
BorderBottom(true).
|
||||||
|
BorderStyle(lipgloss.NormalBorder()).
|
||||||
|
BorderForeground(lipgloss.Color(colors.border)).
|
||||||
Render(title)
|
Render(title)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user