(d447e04) Render each comment behind a grey bar spanning its length, and bump to 0.32.3

This commit is contained in:
Ansho Rei
2026-08-25 13:56:55 +02:00
parent f0f88025f3
commit b93b8e1b81
5 changed files with 207 additions and 40 deletions
+40 -2
View File
@@ -2002,7 +2002,9 @@ fn detail_of(card: &Card) -> Detail {
// a ratatui paragraph would draw as literal bytes.
let mut parts = content_parts(&content, true, &resolved);
let mut block = vec![Cell::plain("\n")];
block.extend(history_cells(&history));
// The board carries colour, so the quote bars a comment and a reason draw are the
// same cells `show` paints: one layout, two renderers.
block.extend(history_cells(&history, true));
parts.push(BodyPart::Cells(block));
Detail {
@@ -5493,6 +5495,11 @@ mod tests {
assert_eq!(span_color(&change, "claude"), Some(tag_color("claude").into()));
assert_eq!(span_color(&change, "2026-08-21 12:00:00"), Some(Color::Cyan.into()));
// The quote bar rides in the same cells: grey, and carrying the gap before the
// text so a pipe can replace the pair with its width.
let said = body_line(detail, "And why.");
assert_eq!(span_color(&said, "│ "), Some(Color::Grey.into()));
// The other half: the colour arrived as styles, not as bytes.
assert!(
!detail.plain().contains('\x1b'),
@@ -5501,6 +5508,35 @@ mod tests {
);
}
/// The bar is laid out where both renderers read it, so a pasted body draws every
/// line behind it in the overlay too — not only its first, which is the bug this
/// shape replaced.
#[test]
fn the_detail_view_draws_every_line_of_a_comment_behind_the_bar() {
let dir = board_dir();
let uuid = "11111111-0000-4000-8000-000000000000";
write_ticket(&dir, "backlog", uuid, "First one", "");
let history = crate::history::history_dir(&dir, uuid);
std::fs::create_dir_all(&history).unwrap();
std::fs::write(
history.join("20260821_120000_000000_comment.md"),
"**Comment**\nFirst line.\n\nSecond line.\n\n**Author**: bob\n**Time**: \
2026-08-21 12:00:00\n",
)
.unwrap();
let mut board = one_board(&dir);
board.toggle_detail();
let plain = board.detail.as_ref().expect("no detail").plain();
assert!(
plain.contains("│ First line.\n│\n│ Second line."),
"the run is not quoted start to finish:\n{plain}"
);
assert!(!plain.contains('\x1b'), "escapes reached the detail view: {plain:?}");
}
/// The board and `show` share one layout, so the reason a move carries renders
/// indented under the row it explains in the overlay too — attached to its
/// transition rather than sitting apart like a comment.
@@ -5523,7 +5559,9 @@ mod tests {
board.toggle_detail();
let plain = board.detail.as_ref().expect("no detail").plain();
let expected = "status reviewing → backlog claude (2026-08-21 12:00:00)\n sent back, wrong \
// The board carries colour, so the bar itself is on screen where a pipe would
// draw two spaces: same cells, one layout.
let expected = "status reviewing → backlog claude (2026-08-21 12:00:00)\n│ sent back, wrong \
approach";
assert!(plain.contains(expected), "{plain}");
assert!(!plain.contains('\x1b'), "escapes reached the detail view: {plain:?}");