From 6cd0a8d021949efc5e5705b181a29e5a45047911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E6=A3=AE?= Date: Sun, 10 May 2026 14:47:53 +0800 Subject: [PATCH] feat: add header with version and fix layout calculations --- internal/tui/model.go | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/internal/tui/model.go b/internal/tui/model.go index 4de52e5..a2f4725 100644 --- a/internal/tui/model.go +++ b/internal/tui/model.go @@ -212,7 +212,13 @@ func (m *Model) updateLayout() { rightWidth := 42 leftWidth := m.width - rightWidth - 3 - chatHeight := m.height - 5 + headerHeight := 3 + mainHeight := m.height - headerHeight - 1 + inputHeight := 5 + chatHeight := mainHeight - inputHeight + if chatHeight < 10 { + chatHeight = 10 + } m.textarea.SetWidth(leftWidth) m.viewport.Width = leftWidth @@ -261,7 +267,15 @@ func (m Model) View() string { rightWidth := 42 leftWidth := m.width - rightWidth - 3 - chatHeight := m.height - 5 + headerHeight := 3 + mainHeight := m.height - headerHeight - 1 + inputHeight := 5 + chatHeight := mainHeight - inputHeight + if chatHeight < 10 { + chatHeight = 10 + } + + header := m.renderHeader() chatBox := boxStyle.Width(leftWidth).Height(chatHeight).Render(m.viewport.View()) inputBox := boxStyle.Width(leftWidth).Render(m.textarea.View()) @@ -272,7 +286,7 @@ func (m Model) View() string { statsHeight := lipgloss.Height(stats) agentsHeight := lipgloss.Height(agents) - remainingHeight := m.height - statsHeight - agentsHeight - 2 + remainingHeight := mainHeight - statsHeight - agentsHeight - 2 if remainingHeight < 3 { remainingHeight = 3 } @@ -284,7 +298,19 @@ func (m Model) View() string { leftPanel = lipgloss.JoinVertical(lipgloss.Left, leftPanel, processingStyle.Render("Processing...")) } - return lipgloss.JoinHorizontal(lipgloss.Top, leftPanel, rightPanel) + body := lipgloss.JoinHorizontal(lipgloss.Top, leftPanel, rightPanel) + return lipgloss.JoinVertical(lipgloss.Left, header, body) +} + +func (m Model) renderHeader() string { + version := "v0.1.0" + title := titleStyle.Render("orca.agent ") + mutedStyle.Render(version) + return lipgloss.NewStyle(). + Width(m.width). + Height(1). + Padding(0, 1). + Background(lipgloss.Color(colors.bg)). + Render(title) } func (m Model) renderStats() string {