rho-coding-agent 3.12.0

A fast Rust agent harness with a small footprint and opinionated defaults
Documentation
use super::*;
use pretty_assertions::assert_eq;

// Covers: a wrap boundary must not detach combining marks, emoji modifiers,
// regional indicators, or keycap selectors, even in a one-column viewport.
// Owner: pure wrap math; PTY rendering cannot reveal the source byte partition.
#[test]
fn wrap_boundaries_preserve_whole_graphemes() {
    for (text, width, expected) in [
        ("e\u{301}x", 1, vec!["e\u{301}", "x"]),
        ("πŸ‘©πŸ½β€πŸ’»x", 2, vec!["πŸ‘©πŸ½β€πŸ’»", "x"]),
        ("πŸ‡ΊπŸ‡ΈπŸ‡¨πŸ‡¦", 2, vec!["πŸ‡ΊπŸ‡Έ", "πŸ‡¨πŸ‡¦"]),
        ("1️⃣x", 1, vec!["1️⃣", "x"]),
        (" \u{301}x", 1, vec![" \u{301}", "x"]),
    ] {
        for ranges in [
            wrap_line_at_whitespace_ranges(text, width),
            hard_wrap_ranges(text, width),
        ] {
            let rows: Vec<_> = ranges.into_iter().map(|range| &text[range]).collect();
            assert_eq!(rows, expected, "text {text:?}, width {width}");
        }
    }
}

// Covers: a no-break space never becomes a wrap point, so an icon stays on
// its path's row, while an ordinary space still is one.
// Owner: pure wrap math.
#[test]
fn no_break_spaces_glue_their_neighbours() {
    let text = "see \u{e7a8}\u{a0}src/main.rs";
    let rows: Vec<_> = wrap_line_at_whitespace(text, 14);
    assert_eq!(rows, ["see ", "\u{e7a8}\u{a0}src/main.rs"]);
    // A width split of a token wider than the row keeps them together too,
    // whether the row would end on the icon or on its gap.
    for width in [10, 11] {
        let rows: Vec<_> = wrap_line_at_whitespace("--config=\u{e7a8}\u{a0}a.rs", width);
        assert_eq!(rows, ["--config=", "\u{e7a8}\u{a0}a.rs"], "width {width}");
    }
}