fix: remove textarea resize from View() and fix right panel height

This commit is contained in:
大森 2026-05-10 14:44:38 +08:00
parent 606ee5fa0a
commit 8d543a7020

View File

@ -263,17 +263,21 @@ func (m Model) View() string {
leftWidth := m.width - rightWidth - 3 leftWidth := m.width - rightWidth - 3
chatHeight := m.height - 5 chatHeight := m.height - 5
m.textarea.SetWidth(leftWidth)
m.viewport.Width = leftWidth
m.viewport.Height = chatHeight
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)
stats := m.renderStats() stats := m.renderStats()
agents := m.renderAgents() agents := m.renderAgents()
empty := boxStyle.Width(rightWidth - 4).Height(m.height - 20).Render("")
statsHeight := lipgloss.Height(stats)
agentsHeight := lipgloss.Height(agents)
remainingHeight := m.height - statsHeight - agentsHeight - 2
if remainingHeight < 3 {
remainingHeight = 3
}
empty := boxStyle.Width(rightWidth - 4).Height(remainingHeight).Render("")
rightPanel := lipgloss.JoinVertical(lipgloss.Left, stats, agents, empty) rightPanel := lipgloss.JoinVertical(lipgloss.Left, stats, agents, empty)
if m.loading { if m.loading {