Projector: a section heading over nothing is left out
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
fd9d8e2d63
commit
eadef8e0fd
2 changed files with 6 additions and 3 deletions
|
|
@ -577,13 +577,15 @@ fn newest_section(heading: &str, lines: &[String], cap: usize) -> String {
|
|||
if !out.push(heading) {
|
||||
return String::new();
|
||||
}
|
||||
let mut shown = false;
|
||||
if dropped > 0 {
|
||||
out.push(&format!("({dropped} earlier not shown)"));
|
||||
shown |= out.push(&format!("({dropped} earlier not shown)"));
|
||||
}
|
||||
for line in kept {
|
||||
out.push(line);
|
||||
shown |= out.push(line);
|
||||
}
|
||||
out.out
|
||||
// A heading over nothing says nothing.
|
||||
if shown { out.out } else { String::new() }
|
||||
}
|
||||
|
||||
/// The messages to her as lines under the `addressed_bytes` ceiling: whole messages, newest first, until the ceiling;
|
||||
|
|
|
|||
|
|
@ -1056,6 +1056,7 @@ fn a_beat_respects_a_small_cap() {
|
|||
let room = Room { tail: (0..6).map(|at| message("#swarm:gamecult.org", "@kiko:gamecult.org", "", &"x".repeat(150), 30 - at, false)).collect(), ..Room::default() };
|
||||
let packet = packet_tuned(TurnKind::Beat, &state(), &room, &History::default(), 1, &tuning);
|
||||
assert!(packet.stimulus.len() <= cap, "cap {cap}: {} {:?}", packet.stimulus.len(), packet.stimulus);
|
||||
assert!(!packet.stimulus.trim_end().ends_with("Lately in her rooms:"), "cap {cap}: no heading over nothing: {:?}", packet.stimulus);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue