The open source coding agent.
TypeScript
fix(tui): min width on user messages
adamdottvd2176064e160
diff --git a/packages/tui/internal/components/chat/message.go b/packages/tui/internal/components/chat/message.goindex f547907eec3..6fa52c1f4f5 100644--- a/packages/tui/internal/components/chat/message.go+++ b/packages/tui/internal/components/chat/message.go@@ -226,11 +226,18 @@ func renderText(message client.MessageInfo, text string, author string) string {if message.Role == client.Assistant {markdownWidth = width - padding - 4 - 3}- if message.Role == client.User {- text = strings.ReplaceAll(text, "<", "\\<")- text = strings.ReplaceAll(text, ">", "\\>")+ minWidth := max(markdownWidth, (width-4)/2)+ messageStyle := styles.NewStyle().+ Width(minWidth).+ Background(t.BackgroundPanel()).+ Foreground(t.Text())+ if textWidth < minWidth {+ messageStyle = messageStyle.AlignHorizontal(lipgloss.Right)+ }+ content := messageStyle.Render(text)+ if message.Role == client.Assistant {+ content = toMarkdown(text, markdownWidth, t.BackgroundPanel())}- content := toMarkdown(text, markdownWidth, t.BackgroundPanel())content = strings.Join([]string{content, info}, "\n")switch message.Role {@@ -409,7 +416,7 @@ func renderToolInvocation(title = fmt.Sprintf("WRITE %s", relative(filename))if content, ok := toolArgsMap["content"].(string); ok {body = renderFile(filename, content)-+// Add diagnostics at the bottom if they existif diagnostics := renderDiagnostics(metadata, filename); diagnostics != "" {body += "\n" + renderContentBlock(diagnostics, WithFullWidth(), WithBorderColor(t.Error()))@@ -753,7 +760,7 @@ func renderDiagnostics(metadata client.MessageMetadata_Tool_AdditionalPropertiescontinue}- line := diag.Range.Start.Line + 1 // 1-based+ line := diag.Range.Start.Line + 1 // 1-basedcolumn := diag.Range.Start.Character + 1 // 1-basederrorDiagnostics = append(errorDiagnostics, fmt.Sprintf("Error [%d:%d] %s", line, column, diag.Message))}