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:
+36
-5
@@ -503,12 +503,14 @@ pub fn banner_box(
|
|||||||
let fill = w + 2 - visible_len(&title);
|
let fill = w + 2 - visible_len(&title);
|
||||||
let left = fill / 2;
|
let left = fill / 2;
|
||||||
let right = fill - left;
|
let right = fill - left;
|
||||||
rows.push(frame(&format!(
|
// Paint each segment separately: the title's own reset must not cancel
|
||||||
"╭{}{}{}╮",
|
// the frame color of the dashes on its right.
|
||||||
"─".repeat(left),
|
rows.push(format!(
|
||||||
|
"{}{}{}",
|
||||||
|
frame(&format!("╭{}", "─".repeat(left))),
|
||||||
title,
|
title,
|
||||||
"─".repeat(right)
|
frame(&format!("{}╮", "─".repeat(right))),
|
||||||
)));
|
));
|
||||||
|
|
||||||
// Block-art title, painted in the theme accent color.
|
// Block-art title, painted in the theme accent color.
|
||||||
for art in banner_art() {
|
for art in banner_art() {
|
||||||
@@ -1656,6 +1658,35 @@ mod tests {
|
|||||||
assert!(widths.iter().all(|w| *w == widths[0]), "unaligned box:\n{text}");
|
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]
|
#[test]
|
||||||
fn is_am_command_recognizes_known_commands() {
|
fn is_am_command_recognizes_known_commands() {
|
||||||
for cmd in [
|
for cmd in [
|
||||||
|
|||||||
Reference in New Issue
Block a user