@@ -15,7 +15,8 @@ type LogEntry struct {
1515 Content string
1616 }
1717
18-// wrapText wraps text to fit within maxWidth, preserving words.
18+// wrapText wraps text to fit within maxWidth display columns, preserving words.
19+// Uses lipgloss.Width() for proper Unicode character width calculation.
1920 func wrapText(text string, maxWidth int) []string {
2021 if maxWidth <= 0 {
2122 maxWidth = 80
@@ -38,7 +39,10 @@ func wrapText(text string, maxWidth int) []string {
3839
3940 currentLine := words[0]
4041 for _, word := range words[1:] {
41- if len(currentLine)+1+len(word) <= maxWidth {
42+ // Use lipgloss.Width() for proper Unicode width calculation
43+ lineWidth := lipgloss.Width(currentLine)
44+ wordWidth := lipgloss.Width(word)
45+ if lineWidth+1+wordWidth <= maxWidth {
4246 currentLine += " " + word
4347 } else {
4448 lines = append(lines, currentLine)
@@ -55,9 +59,8 @@ func wrapText(text string, maxWidth int) []string {
5559 func RenderFocusView(agent AgentInfo, logs []LogEntry, width, height int, isLoading bool, spinnerView string) string {
5660 var sections []string
5761
58- // Header with agent name
59- headerText := fmt.Sprintf("═══ AGENT: %s ═══", agent.Name)
60- header := headerStyle.Width(width).Render(headerText)
62+ // Header with agent name - spans full width
63+ header := renderFocusHeader(agent.Name, width)
6164 sections = append(sections, header)
6265
6366 // Agent info panel
@@ -72,11 +75,11 @@ func RenderFocusView(agent AgentInfo, logs []LogEntry, width, height int, isLoad
7275 fmt.Sprintf("%s %s", labelStyle.Render("Provider:"), valueStyle.Render(agent.Provider)),
7376 }
7477 infoContent := strings.Join(infoLines, " ")
75- infoPanel := panelStyle.Width(width - 4).Render(infoContent)
78+ infoPanel := panelStyle.Width(width - 2).Render(infoContent)
7679 sections = append(sections, infoPanel)
7780
78- // Logs panel
79- logTitle := panelTitleStyle.Render("── Conversation ──")
81+ // Logs panel - use full-width section title
82+ logTitle := renderSectionTitle("CONVERSATION LOG", width)
8083 sections = append(sections, logTitle)
8184
8285 // Calculate available height for logs
@@ -87,12 +90,15 @@ func RenderFocusView(agent AgentInfo, logs []LogEntry, width, height int, isLoad
8790 }
8891
8992 var logLines []string
93+ // Panel is rendered with logStyle.Width(width - 2).Padding(0, 2)
94+ // Content width = width - 2, minus 4 for padding (2 each side) = width - 6
95+ panelContentWidth := width - 6
9096 if len(logs) == 0 {
9197 logLines = append(logLines, dimmedStyle.Render("No conversation history."))
9298 } else {
93- // Render all log entries
99+ // Render all log entries to fill panel content area
94100 for _, entry := range logs {
95- entryLines := renderLogEntry(entry, width-6)
101+ entryLines := renderLogEntry(entry, panelContentWidth)
96102 logLines = append(logLines, entryLines...)
97103 }
98104
@@ -103,11 +109,11 @@ func RenderFocusView(agent AgentInfo, logs []LogEntry, width, height int, isLoad
103109 }
104110
105111 logContent := strings.Join(logLines, "\n")
106- logPanel := logStyle.Width(width - 4).Height(logHeight).Render(logContent)
112+ logPanel := logStyle.Width(width-2).Height(logHeight).Padding(0, 2).Render(logContent)
107113 sections = append(sections, logPanel)
108114
109115 // Footer
110- hint := dimmedStyle.Render("Esc: back | m: message | r: relaunch | s: stop | c: configure")
116+ hint := dimmedStyle.Render("[ ESC ] BACK · [ m ] MESSAGE · [ r ] RELAUNCH · [ s ] STOP")
111117 sections = append(sections, hint)
112118
113119 return lipgloss.JoinVertical(lipgloss.Left, sections...)
@@ -117,9 +123,8 @@ func RenderFocusView(agent AgentInfo, logs []LogEntry, width, height int, isLoad
117123 func RenderFocusViewWithViewport(agent AgentInfo, vp viewport.Model, width int, isLoading bool, spinnerView string, autoScroll bool) string {
118124 var sections []string
119125
120- // Header with agent name
121- headerText := fmt.Sprintf("═══ AGENT: %s ═══", agent.Name)
122- header := headerStyle.Width(width).Render(headerText)
126+ // Header with agent name - spans full width
127+ header := renderFocusHeader(agent.Name, width)
123128 sections = append(sections, header)
124129
125130 // Agent info panel
@@ -134,47 +139,64 @@ func RenderFocusViewWithViewport(agent AgentInfo, vp viewport.Model, width int,
134139 fmt.Sprintf("%s %s", labelStyle.Render("Provider:"), valueStyle.Render(agent.Provider)),
135140 }
136141 infoContent := strings.Join(infoLines, " ")
137- infoPanel := panelStyle.Width(width - 4).Render(infoContent)
142+ infoPanel := panelStyle.Width(width - 2).Render(infoContent)
138143 sections = append(sections, infoPanel)
139144
140- // Conversation title with scroll indicator
145+ // Conversation title with scroll indicator - spans full width
141146 scrollInfo := ""
142147 if !autoScroll {
143- scrollInfo = dimmedStyle.Render(" (scrolled)")
148+ scrollInfo = " ↑ SCROLLED"
144149 }
145- logTitle := panelTitleStyle.Render("── Conversation ──") + scrollInfo
150+ logTitle := renderSectionTitleWithSuffix("CONVERSATION LOG", scrollInfo, width)
146151 sections = append(sections, logTitle)
147152
148153 // Viewport content (scrollable)
149- vpView := logStyle.Width(width - 4).Render(vp.View())
154+ // Add horizontal padding (2 spaces each side) for content inside panel border
155+ vpView := logStyle.Width(width-2).Padding(0, 2).Render(vp.View())
150156 sections = append(sections, vpView)
151157
152158 // Footer with scroll hints
153- hint := dimmedStyle.Render("Esc: back | m: message | ↑↓/PgUp/PgDn: scroll | G/End: bottom")
159+ hint := dimmedStyle.Render("[ ESC ] BACK · [ m ] MESSAGE · [ ↑↓ ] SCROLL · [ G ] BOTTOM")
154160 sections = append(sections, hint)
155161
156162 return lipgloss.JoinVertical(lipgloss.Left, sections...)
157163 }
158164
165+// logBgColor is the background color for log entries (same as colorBgPanel)
166+var logBgColor = colorBgPanel
167+
159168 func renderLogEntry(entry LogEntry, maxWidth int) []string {
160- roleStyle := RoleStyle(entry.Role)
169+ // Get the role's foreground color and create a style with background
170+ roleColor := RoleColor(entry.Role)
171+ prefixStyle := lipgloss.NewStyle().
172+ Foreground(roleColor).
173+ Background(logBgColor)
174+
175+ // Content style - just background, no foreground override
176+ contentStyle := lipgloss.NewStyle().
177+ Background(logBgColor)
161178
162179 var prefix string
163180 switch entry.Role {
164181 case "user":
165- prefix = "YOU: "
182+ prefix = "YOU: "
166183 case "assistant":
167- prefix = "AI: "
184+ prefix = "AI: "
168185 case "system":
169- prefix = "SYS: "
186+ prefix = "SYS: "
170187 case "tool":
171- prefix = "TOOL: "
188+ prefix = "TOOL:"
172189 default:
173- prefix = "???: "
190+ prefix = "???:"
174191 }
175192
176- // Calculate content width (accounting for prefix on first line, indent on rest)
177- contentWidth := maxWidth - len(prefix) - 2
193+ // Inside padding: 1 space on left and right of all content
194+ const padLeft = 1
195+ const padRight = 1
196+
197+ // Calculate content width (accounting for prefix, padding, and gap after prefix)
198+ prefixWidth := len(prefix) + 1 // +1 for space after prefix
199+ contentWidth := maxWidth - prefixWidth - padLeft - padRight
178200 if contentWidth < 20 {
179201 contentWidth = 20
180202 }
@@ -183,13 +205,33 @@ func renderLogEntry(entry LogEntry, maxWidth int) []string {
183205 wrappedLines := wrapText(entry.Content, contentWidth)
184206
185207 var result []string
186- indent := strings.Repeat(" ", len(prefix))
208+ indent := strings.Repeat(" ", prefixWidth)
209+
210+ // Add top padding (empty line with background)
211+ emptyLine := contentStyle.Width(maxWidth).Render("")
212+ result = append(result, emptyLine)
187213
188214 for i, line := range wrappedLines {
215+ // Pad the line content to fill remaining width
216+ lineLen := lipgloss.Width(line)
217+ remainingWidth := contentWidth - lineLen
218+ if remainingWidth < 0 {
219+ remainingWidth = 0
220+ }
221+ paddedLine := line + strings.Repeat(" ", remainingWidth+padRight)
222+
189223 if i == 0 {
190- result = append(result, roleStyle.Render(prefix)+line)
224+ // First line: left pad + styled prefix + space + content with background
225+ leftPad := contentStyle.Render(strings.Repeat(" ", padLeft))
226+ styledPrefix := prefixStyle.Render(prefix)
227+ styledContent := contentStyle.Render(" " + paddedLine)
228+ result = append(result, leftPad+styledPrefix+styledContent)
191229 } else {
192- result = append(result, roleStyle.Render(indent)+line)
230+ // Continuation lines: left pad + indent + content with background
231+ leftPad := contentStyle.Render(strings.Repeat(" ", padLeft))
232+ styledIndent := contentStyle.Render(indent)
233+ styledContent := contentStyle.Render(paddedLine)
234+ result = append(result, leftPad+styledIndent+styledContent)
193235 }
194236 }
195237
@@ -203,3 +245,21 @@ func LogEntryFromMemory(m *store.Memory) LogEntry {
203245 Content: m.Content,
204246 }
205247 }
248+
249+// renderFocusHeader renders the focus view header spanning full width.
250+func renderFocusHeader(agentName string, width int) string {
251+ // Format: ◆─── ⬡ AGENT: name ⬡ ───◆ with dashes filling the remaining space
252+ // Use lipgloss.Width() for proper Unicode display width calculation
253+ titleText := " ⬡ AGENT: " + agentName + " ⬡ "
254+ titleDisplayWidth := lipgloss.Width(titleText)
255+ // Total fixed chars: ◆ (1) on each side = 2
256+ availableWidth := width - titleDisplayWidth - 2
257+ if availableWidth < 4 {
258+ availableWidth = 4
259+ }
260+ leftDashes := availableWidth / 2
261+ rightDashes := availableWidth - leftDashes
262+
263+ line := "◆" + strings.Repeat("─", leftDashes) + titleText + strings.Repeat("─", rightDashes) + "◆"
264+ return headerStyle.Width(width).Render(line)
265+}