diff --git a/crates/tui/src/tui/history.rs b/crates/tui/src/tui/history.rs index f2ce686e..1c329ac8 100644 --- a/crates/tui/src/tui/history.rs +++ b/crates/tui/src/tui/history.rs @@ -309,13 +309,9 @@ impl HistoryCell { options: TranscriptRenderOptions, ) -> Vec { match self { - HistoryCell::User { content } => render_message_with_copy_metadata( - USER_GLYPH, - user_label_style(), - user_body_style(), - content, - width, - ), + HistoryCell::User { content } => { + hard_break_copy_lines(render_user_message(content, width)) + } HistoryCell::Assistant { content, streaming } => render_message_with_copy_metadata( ASSISTANT_GLYPH, assistant_label_style_for(*streaming, options.low_motion), diff --git a/crates/tui/src/tui/transcript.rs b/crates/tui/src/tui/transcript.rs index 53319c96..64d12bea 100644 --- a/crates/tui/src/tui/transcript.rs +++ b/crates/tui/src/tui/transcript.rs @@ -554,6 +554,7 @@ fn truncate_spans_to_width(spans: Vec>, max_width: usize) -> Vec Vec { @@ -595,6 +596,20 @@ mod tests { })) } + #[test] + fn cache_renders_user_cells_with_highlight_background() { + let cells = vec![user_cell("# literal user prompt")]; + let revisions = vec![1u64]; + + let mut cache = TranscriptViewCache::new(); + cache.ensure(&cells, &revisions, 40, TranscriptRenderOptions::default()); + + let lines = cache.lines(); + assert_eq!(lines[0].style.bg, Some(palette::SURFACE_ELEVATED)); + assert_eq!(lines[0].width(), 40); + assert_eq!(plain_lines(&cache)[0].trim_end(), "▎ # literal user prompt"); + } + #[test] fn cache_reuses_cells_when_revision_unchanged() { let cells = vec![