v0.2.14 : correction bordure haute du splash - les tirets a droite du titre gardent la couleur du theme (reset du titre ne casse plus le cadre)

This commit is contained in:
2026-08-16 20:45:21 -04:00
parent 843c3e1278
commit b3437b0601
+36 -5
View File
@@ -503,12 +503,14 @@ pub fn banner_box(
let fill = w + 2 - visible_len(&title);
let left = fill / 2;
let right = fill - left;
rows.push(frame(&format!(
"╭{}{}{}╮",
"─".repeat(left),
// Paint each segment separately: the title's own reset must not cancel
// the frame color of the dashes on its right.
rows.push(format!(
"{}{}{}",
frame(&format!("╭{}", "─".repeat(left))),
title,
"─".repeat(right)
)));
frame(&format!("{}╮", "─".repeat(right))),
));
// Block-art title, painted in the theme accent color.
for art in banner_art() {
@@ -1656,6 +1658,35 @@ mod tests {
assert!(widths.iter().all(|w| *w == widths[0]), "unaligned box:\n{text}");
}
#[test]
fn banner_top_border_right_dashes_keep_the_frame_color() {
let session = test_session();
let ocean = crate::theme::find("ocean").unwrap();
let text = banner_box(
"9.9.9",
65,
3,
12,
&session,
"20260815_123456_abcdef",
"/home/alice/dev/agent-manager",
ocean,
true,
);
let top = text.lines().next().unwrap();
// The painted title ends with a reset; the dashes after it must be
// re-painted with the frame color instead of staying default.
let Some(reset_pos) = top.find("\x1b[0m") else {
panic!("no title reset in top border: {top:?}");
};
let tail = &top[reset_pos + "\x1b[0m".len()..];
assert!(tail.contains('─'), "no dashes after the title: {tail:?}");
assert!(
tail.contains("\x1b["),
"right dashes not re-painted with the frame color: {tail:?}"
);
}
#[test]
fn is_am_command_recognizes_known_commands() {
for cmd in [