diff --git a/prettyFormat.go b/prettyFormat.go index e0405b3..513fe10 100644 --- a/prettyFormat.go +++ b/prettyFormat.go @@ -143,11 +143,23 @@ func printCodeSnippet(snippet *chatpb.CodeSnippet) { language := filepath.Base(snippet.GetFilename()) // Still useful for display fmt.Println() // Add extra line feed for spacing - fmt.Printf("┌─[ Code Snippet: %s ]──────────────────────────────────\n", language) + + // --- Top Border --- + topBorder := fmt.Sprintf("┌─[ Code Snippet: %s ]", language) + fmt.Printf("%s%s┐\n", topBorder, strings.Repeat("─", termWidth-len(topBorder)-1)) + + // --- Content Lines --- for _, line := range strings.Split(strings.TrimSpace(code), "\n") { - fmt.Printf("│ %s\n", line) + // Calculate padding: total width - borders/padding - text length + padding := termWidth - 4 - len(line) + if padding < 0 { + padding = 0 // Should not happen with wrapping, but as a safeguard + } + fmt.Printf("│ %s%s │\n", line, strings.Repeat(" ", padding)) } - fmt.Printf("└─────────────────────────────────────────────────────────\n\n") + + // --- Bottom Border --- + fmt.Printf("└%s┘\n\n", strings.Repeat("─", termWidth-2)) } func printToolCallBox(tc *chatpb.ToolCall) {