diff --git a/crates/mind-body/src/projection/select.rs b/crates/mind-body/src/projection/select.rs index c90a397..d7e1449 100644 --- a/crates/mind-body/src/projection/select.rs +++ b/crates/mind-body/src/projection/select.rs @@ -757,7 +757,7 @@ fn sender_name(sender: &str, inputs: &Inputs) -> String { /// A reply as every line renders it (map 16.20.8 (D), K20): the line it answers, above it, by who said it and in the words /// the mouth quoted (`> {other}: "…"`), and `, replying to {other}` after the speaker's name. Both empty for a line that /// replies to nothing. When the page lists the answered line whole (`listed`), the reply names it by who and when -/// (`, replying to {other}'s line (15 min ago, shown here)`) and quotes it no second time, wherever the name is no longer +/// (`, replying to a line shown here ({other}, 15 min ago)`) and quotes it no second time, wherever the name is no longer /// than the quote: a selection made on quoted lines then still fits. fn reply_parts(line: &RoomLine, inputs: &Inputs, listed: &[&RoomLine]) -> (String, String) { let Some(replied) = &line.reply else { @@ -765,7 +765,7 @@ fn reply_parts(line: &RoomLine, inputs: &Inputs, listed: &[&RoomLine]) -> (Strin }; let other = sender_name(&replied.sender, inputs); let (above, replying) = (format!("> {other}: {}\n", excerpt(replied)), format!(", replying to {other}")); - let named = listed.iter().find(|shown| !replied.event.is_empty() && shown.event == replied.event).map(|shown| format!(", replying to {other}'s line ({}, shown here)", when(shown, inputs))); + let named = listed.iter().find(|shown| !replied.event.is_empty() && shown.event == replied.event).map(|shown| format!(", replying to a line shown here ({other}, {})", when(shown, inputs))); match named { Some(named) if named.len() <= above.len() + replying.len() => (String::new(), named), _ => (above, replying), diff --git a/crates/mind-body/src/projection/simulate/tests.rs b/crates/mind-body/src/projection/simulate/tests.rs index 3fa7b0c..7195449 100644 --- a/crates/mind-body/src/projection/simulate/tests.rs +++ b/crates/mind-body/src/projection/simulate/tests.rs @@ -535,7 +535,8 @@ fn passing_on() -> Scripted { } /// K20 in the simulator: the room records the reply relation by the replied line's event, as the mouth will (B3), and -/// every later view shows Meta's line, with who said it, above Tobiah's; his line holds only his own words. +/// every later view shows Meta's line, with who said it, above Tobiah's, or names it where the view lists it whole; his line +/// holds only his own words. #[test] fn k20_the_room_records_a_reply_and_another_minds_packet_shows_the_line_above_it() { let dir = tempfile::tempdir().unwrap(); @@ -547,7 +548,8 @@ fn k20_the_room_records_a_reply_and_another_minds_packet_shows_the_line_above_it assert!(transcript.iter().filter(|line| line["from"] == TOBIAH).all(|line| line["says"] == "She greeted all of us, Libby."), "his line holds his words alone: {transcript:?}"); let libby = run["turns"].as_array().unwrap().iter().find(|turn| turn["persona"] == "Libby" && turn["round"] == 2).expect("his line wakes her under all_messages"); let heard = libby["report"]["packet"]["heard"].as_str().unwrap(); - assert!(heard.contains("Just now:\n> Meta, who runs the place: \"good afternoon, everyone\"\n\"Tobiah\" (@eureka:gamecult.org), replying to Meta, who runs the place, in #minds:gamecult.org: \"She greeted all of us, Libby.\""), "{heard}"); + assert!(heard.contains("Meta, who runs the place, 4 min ago: \"good afternoon, everyone\"\nJust now:\n\"Tobiah\" (@eureka:gamecult.org), replying to a line shown here (Meta, who runs the place, 4 min ago), in #minds:gamecult.org: \"She greeted all of us, Libby.\""), "{heard}"); + assert_eq!(heard.matches("good afternoon, everyone").count(), 1, "Meta's line is listed once: {heard}"); } #[test] diff --git a/crates/mind-body/src/projection/tests.rs b/crates/mind-body/src/projection/tests.rs index 28f6e8e..5c97202 100644 --- a/crates/mind-body/src/projection/tests.rs +++ b/crates/mind-body/src/projection/tests.rs @@ -2307,13 +2307,13 @@ fn k20_a_reply_to_a_line_listed_whole_names_it_and_quotes_it_no_second_time() { for page in [&packet.heard, &packet.bridged] { assert_eq!((page.matches("MARMOSET").count(), page.matches("OSPREY").count()), (1, 1), "{page}"); assert!(!page.contains("> "), "{page}"); - assert!(page.contains("Kiko, replying to Eureka's line (15 min ago, shown here), in #minds:gamecult.org: \"did the file go out?\""), "{page}"); - assert!(page.contains(", replying to Meta, the operator's line (just now, shown here), in #minds:gamecult.org: \"I can't confirm that.\""), "{page}"); + assert!(page.contains("Kiko, replying to a line shown here (Eureka, 15 min ago), in #minds:gamecult.org: \"did the file go out?\""), "{page}"); + assert!(page.contains(", replying to a line shown here (Meta, the operator, just now), in #minds:gamecult.org: \"I can't confirm that.\""), "{page}"); } let stimulus = &packet.stimulus; assert_eq!((stimulus.matches("MARMOSET").count(), stimulus.matches("OSPREY").count(), stimulus.contains("> ")), (0, 1, false), "{stimulus}"); - assert!(stimulus.contains("- Kiko in #minds:gamecult.org, replying to Eureka's line (15 min ago, shown here): "), "{stimulus}"); - assert!(stimulus.contains(", replying to Meta, the operator's line (just now, shown here): "), "{stimulus}"); + assert!(stimulus.contains("- Kiko in #minds:gamecult.org, replying to a line shown here (Eureka, 15 min ago): "), "{stimulus}"); + assert!(stimulus.contains(", replying to a line shown here (Meta, the operator, just now): "), "{stimulus}"); assert!(packet.bodies.iter().any(|body| body == META), "{:?}", packet.bodies); }