@@ -303,13 +303,13 @@ func TestRenderFocusView(t *testing.T) {
303303 {Role: "assistant", Content: "Hi there! This is a longer response that might span multiple lines when properly wrapped in the terminal window."},
304304 }
305305
306- view := RenderFocusView(mysis, logs, 80, 24, false, "⠋")
306+ view := RenderFocusView(mysis, logs, 80, 24, false, "⠋", false)
307307 if view == "" {
308308 t.Error("expected non-empty focus view")
309309 }
310310
311311 // Test with loading state
312- viewLoading := RenderFocusView(mysis, logs, 80, 24, true, "⠋")
312+ viewLoading := RenderFocusView(mysis, logs, 80, 24, true, "⠋", false)
313313 if viewLoading == "" {
314314 t.Error("expected non-empty focus view with loading")
315315 }
@@ -451,7 +451,7 @@ func TestRenderLogEntry(t *testing.T) {
451451 for _, tt := range tests {
452452 t.Run(tt.name, func(t *testing.T) {
453453 entry := LogEntry{Role: tt.role, Content: tt.content}
454- lines := renderLogEntry(entry, tt.maxWidth)
454+ lines := renderLogEntryImpl(entry, tt.maxWidth, false)
455455 if len(lines) == 0 {
456456 t.Error("expected at least one line of output")
457457 }
@@ -467,7 +467,7 @@ func TestRenderLogEntryPadding(t *testing.T) {
467467 // Test that log entries have proper padding on all sides
468468 entry := LogEntry{Role: "user", Content: "Test message"}
469469 maxWidth := 80
470- lines := renderLogEntry(entry, maxWidth)
470+ lines := renderLogEntryImpl(entry, maxWidth, false)
471471
472472 // Should have at least 2 lines: empty line (top padding) + content
473473 if len(lines) < 2 {
@@ -506,7 +506,7 @@ func TestRenderLogEntryLineWidthConsistent(t *testing.T) {
506506 Content: "First line\nSecond line\nThird line that is longer",
507507 }
508508 maxWidth := 60
509- lines := renderLogEntry(entry, maxWidth)
509+ lines := renderLogEntryImpl(entry, maxWidth, false)
510510
511511 if len(lines) < 2 {
512512 t.Fatalf("expected multiple lines, got %d", len(lines))
@@ -534,7 +534,7 @@ func TestRenderLogEntryBackgroundApplied(t *testing.T) {
534534 Content: "First line\nSecond line\nThird line",
535535 }
536536 maxWidth := 60
537- lines := renderLogEntry(entry, maxWidth)
537+ lines := renderLogEntryImpl(entry, maxWidth, false)
538538
539539 if len(lines) < 3 {
540540 t.Fatalf("expected at least 3 lines, got %d", len(lines))
@@ -564,7 +564,7 @@ func TestRenderLogEntryPaddingAllRoles(t *testing.T) {
564564 for _, role := range roles {
565565 t.Run(role, func(t *testing.T) {
566566 entry := LogEntry{Role: role, Content: "Test content"}
567- lines := renderLogEntry(entry, 80)
567+ lines := renderLogEntryImpl(entry, 80, false)
568568
569569 if len(lines) < 2 {
570570 t.Fatalf("expected at least 2 lines, got %d", len(lines))
@@ -728,7 +728,7 @@ func TestRenderFocusViewWithAllRoles(t *testing.T) {
728728 {Role: "tool", Content: "Tool result"},
729729 }
730730
731- view := RenderFocusView(mysis, logs, 100, 30, false, "⠋")
731+ view := RenderFocusView(mysis, logs, 100, 30, false, "⠋", false)
732732 if view == "" {
733733 t.Error("expected non-empty focus view")
734734 }
@@ -754,6 +754,7 @@ func TestWrapText(t *testing.T) {
754754 {"needs wrap", "Hello World", 6, 2},
755755 {"multiple paragraphs", "Line one\n\nLine three", 80, 3},
756756 {"zero width defaults", "Test", 0, 1},
757+ {"long word hard wrap", strings.Repeat("a", 100), 50, 2}, // Should hard-wrap long words
757758 }
758759
759760 for _, tt := range tests {
@@ -766,6 +767,28 @@ func TestWrapText(t *testing.T) {
766767 }
767768 }
768769
770+func TestWrapTextLongWordNoOverflow(t *testing.T) {
771+ // Test that long unbreakable words don't cause overflow
772+ longWord := strings.Repeat("a", 200)
773+ text := "Normal text " + longWord + " more text"
774+ maxWidth := 50
775+
776+ lines := wrapText(text, maxWidth)
777+
778+ // Verify no line exceeds maxWidth
779+ for i, line := range lines {
780+ width := lipgloss.Width(line)
781+ if width > maxWidth {
782+ t.Errorf("Line %d exceeds maxWidth %d: got %d\nLine: %s", i, maxWidth, width, line)
783+ }
784+ }
785+
786+ // Should have multiple lines due to hard-wrapping
787+ if len(lines) < 3 {
788+ t.Errorf("Expected at least 3 lines for long word, got %d", len(lines))
789+ }
790+}
791+
769792 func TestRenderHelpContent(t *testing.T) {
770793 help := RenderHelp(100, 40)
771794
@@ -1091,7 +1114,7 @@ func TestLogPanelWidthWithStyledContent(t *testing.T) {
10911114
10921115 var lines []string
10931116 for _, entry := range entries {
1094- entryLines := renderLogEntry(entry, panelContentWidth)
1117+ entryLines := renderLogEntryImpl(entry, panelContentWidth, false)
10951118 lines = append(lines, entryLines...)
10961119 }
10971120 viewportContent := strings.Join(lines, "\n")
@@ -1133,7 +1156,7 @@ func TestLogEntryWidthMatchesPanelContent(t *testing.T) {
11331156
11341157 // Log entries should be rendered at exactly panelInnerWidth
11351158 entry := LogEntry{Role: "assistant", Content: "Test message with enough content"}
1136- lines := renderLogEntry(entry, panelInnerWidth)
1159+ lines := renderLogEntryImpl(entry, panelInnerWidth, false)
11371160
11381161 for i, line := range lines {
11391162 lineWidth := lipgloss.Width(line)
@@ -1156,7 +1179,7 @@ func TestFocusViewAllSectionsMatchWidth(t *testing.T) {
11561179 logTitle := renderSectionTitleWithSuffix("CONVERSATION LOG", "", width)
11571180
11581181 entry := LogEntry{Role: "assistant", Content: "Test message content here"}
1159- entryLines := renderLogEntry(entry, width-4)
1182+ entryLines := renderLogEntryImpl(entry, width-4, false)
11601183 viewportContent := strings.Join(entryLines, "\n")
11611184 vpView := logStyle.Width(width - 2).Render(viewportContent)