From 20b8ce57a8e468e7dff5350c6b69676c290b7623 Mon Sep 17 00:00:00 2001 From: Reuben Grinberg Date: Tue, 3 Nov 2026 15:48:53 -0600 Subject: [PATCH 1/7] Compare: mark a whole inserted/deleted paragraph's mark (#3750) --- crates/engine/src/cmd/tools/compare.rs | 8 ++- crates/engine/src/cmd/tools/tests.rs | 71 ++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/tools/compare.rs b/crates/engine/src/cmd/tools/compare.rs index a62397d830..4c8fad4d22 100644 --- a/crates/engine/src/cmd/tools/compare.rs +++ b/crates/engine/src/cmd/tools/compare.rs @@ -202,7 +202,13 @@ fn block_text(b: &Block, depth: usize) -> String { } } -/// Returns a copy of `b` with all text runs and paragraph marks (or nested table cells) updated by `f`. +/// A copy of the block with every run (in tables, every cell's) changed by `f`, and a paragraph's +/// mark along with them, so a whole inserted or deleted paragraph carries the revision even when +/// the paragraph is empty (`format` returns early for a length-0 range). +/// +/// Known limitation: resolving a revision needs a following paragraph, so a paragraph inserted at +/// the very end (rejected) or deleted from the very end (accepted) still leaves one empty +/// paragraph. That is a separate follow-up, not handled here. fn mark_block(b: &Block, f: &dyn Fn(&mut CharProps), depth: usize) -> Block { match b { Block::Para(p) => { diff --git a/crates/engine/src/cmd/tools/tests.rs b/crates/engine/src/cmd/tools/tests.rs index 0dcc04e0fc..ced4455b7c 100644 --- a/crates/engine/src/cmd/tools/tests.rs +++ b/crates/engine/src/cmd/tools/tests.rs @@ -9,6 +9,77 @@ fn compare_marks_changes() { assert_eq!(s.doc.plain_text(StoryRef::Body), "The dog sat.\nKeep this.\nNew line here."); } +/// Top-level body blocks that are empty paragraphs. +fn empty_paras(s: &Session) -> usize { + s.doc.body.iter().filter(|b| matches!(b.as_para(), Some(p) if p.is_empty())).count() +} + +#[test] +fn compare_marks_a_whole_paragraph_and_its_mark() { + // A whole inserted paragraph carries the insertion on its mark, not just on its runs. + let mut s = Session::new(Document::from_text("A\nB")); + s.run("review.compare", &json!({"text": "A\nNEW\nB"})).unwrap(); + assert_eq!(s.doc.body.len(), 3); + let mid = s.doc.body[1].as_para().unwrap(); + assert_eq!(mid.plain_text(), "NEW"); + assert!(mid.mark.ins.is_some(), "the inserted paragraph's mark is not marked inserted"); + s.run("review.rejectAll", &json!({})).unwrap(); + assert_eq!(s.doc.plain_text(StoryRef::Body), "A\nB"); + assert_eq!(s.doc.body.len(), 2); + assert_eq!(empty_paras(&s), 0, "rejecting an inserted paragraph left an empty paragraph behind"); + let mut s = Session::new(Document::from_text("A\nB")); + s.run("review.compare", &json!({"text": "A\nNEW\nB"})).unwrap(); + s.run("review.acceptAll", &json!({})).unwrap(); + assert_eq!(s.doc.plain_text(StoryRef::Body), "A\nNEW\nB"); + assert_eq!(s.doc.body.len(), 3); + assert_eq!(empty_paras(&s), 0, "accepting an inserted paragraph left an empty paragraph behind"); + + // A whole deleted paragraph carries the deletion on its mark. + let mut s = Session::new(Document::from_text("A\nOLD\nB")); + s.run("review.compare", &json!({"text": "A\nB"})).unwrap(); + assert_eq!(s.doc.body.len(), 3); + let mid = s.doc.body[1].as_para().unwrap(); + assert_eq!(mid.plain_text(), "OLD"); + assert!(mid.mark.del.is_some(), "the deleted paragraph's mark is not marked deleted"); + s.run("review.acceptAll", &json!({})).unwrap(); + assert_eq!(s.doc.plain_text(StoryRef::Body), "A\nB"); + assert_eq!(s.doc.body.len(), 2); + assert_eq!(empty_paras(&s), 0, "accepting a deleted paragraph left an empty paragraph behind"); + let mut s = Session::new(Document::from_text("A\nOLD\nB")); + s.run("review.compare", &json!({"text": "A\nB"})).unwrap(); + s.run("review.rejectAll", &json!({})).unwrap(); + assert_eq!(s.doc.plain_text(StoryRef::Body), "A\nOLD\nB"); + assert_eq!(s.doc.body.len(), 3); + assert_eq!(empty_paras(&s), 0, "rejecting a deleted paragraph left an empty paragraph behind"); +} + +#[test] +fn compare_marks_an_empty_paragraphs_mark() { + // An empty inserted paragraph is stamped on its mark, though `format` skips its empty range. + let mut s = Session::new(Document::from_text("A\nB")); + s.run("review.compare", &json!({"text": "A\n\nB"})).unwrap(); + assert_eq!(s.doc.body.len(), 3); + let empty = s.doc.body[1].as_para().unwrap(); + assert!(empty.is_empty()); + assert!(empty.mark.ins.is_some(), "the empty inserted paragraph's mark is not marked inserted"); + s.run("review.rejectAll", &json!({})).unwrap(); + assert_eq!(s.doc.plain_text(StoryRef::Body), "A\nB"); + assert_eq!(s.doc.body.len(), 2); + assert_eq!(empty_paras(&s), 0, "rejecting an empty inserted paragraph left it behind"); + + // An empty deleted paragraph is stamped on its mark too. + let mut s = Session::new(Document::from_text("A\n\nB")); + s.run("review.compare", &json!({"text": "A\nB"})).unwrap(); + assert_eq!(s.doc.body.len(), 3); + let empty = s.doc.body[1].as_para().unwrap(); + assert!(empty.is_empty()); + assert!(empty.mark.del.is_some(), "the empty deleted paragraph's mark is not marked deleted"); + s.run("review.acceptAll", &json!({})).unwrap(); + assert_eq!(s.doc.plain_text(StoryRef::Body), "A\nB"); + assert_eq!(s.doc.body.len(), 2); + assert_eq!(empty_paras(&s), 0, "accepting an empty deleted paragraph left it behind"); +} + #[test] fn compare_options_ignore_case_and_white_space() { let original = "The Cat sat.\nTwo spaces here."; From 6ce224d4b38f48455ee17e8f3619e68b60bd2419 Mon Sep 17 00:00:00 2001 From: Reuben Grinberg Date: Thu, 5 Nov 2026 08:29:36 -0600 Subject: [PATCH 2/7] Compare: keep another author's deletion stamp on whole-marked paragraphs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Address benandez's review: the del closure in mark_block now uses get_or_insert so a paragraph already carrying another author's tracked deletion keeps that author's revision on its runs and its mark; the ins closure deliberately keeps overwriting (the revised side is a raw clone whose revision indices are never relinked — see the comment; that sourcing is the #5571 root cause). p.touch() after mutating an empty paragraph's mark. Characterization tests pin the terminal-paragraph limitation and the section-break resolve limitation (the resolve fix is filed separately). --- crates/engine/src/cmd/tools/compare.rs | 20 +++++- crates/engine/src/cmd/tools/tests.rs | 86 ++++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd/tools/compare.rs b/crates/engine/src/cmd/tools/compare.rs index 4c8fad4d22..b298ee4ae5 100644 --- a/crates/engine/src/cmd/tools/compare.rs +++ b/crates/engine/src/cmd/tools/compare.rs @@ -146,9 +146,22 @@ pub(super) fn compare(s: &mut Session, v: &Value) -> CmdResult { (Some(Block::Para(pa)), Some(Block::Para(pb))) => out.push(para_block(word_diff(&s.doc, pa, pb, &mut ctx))), _ => { if let Some(x) = a { - out.push(Arc::new(mark_block(x, &|c| c.del = Some(del), 0))); + // An existing deletion is another author's: keep their revision + // stamp instead of re-attributing the paragraph to this compare. + out.push(Arc::new(mark_block( + x, + &|c| { + c.del.get_or_insert(del); + }, + 0, + ))); } if let Some(x) = b { + // The revised side is a raw clone of the revised document (its + // blocks are never relinked into this session's revisions), so any + // stamp it carries names a revision of *that* document: overwrite + // it, since a foreign index kept here would be worse than a valid + // one. out.push(Arc::new(mark_block(x, &|c| c.ins = Some(ins), 0))); } } @@ -208,7 +221,9 @@ fn block_text(b: &Block, depth: usize) -> String { /// /// Known limitation: resolving a revision needs a following paragraph, so a paragraph inserted at /// the very end (rejected) or deleted from the very end (accepted) still leaves one empty -/// paragraph. That is a separate follow-up, not handled here. +/// paragraph. That is a separate follow-up, not handled here. A section-carrying inserted paragraph +/// is a second such limitation: `remove_empty_para` refuses it, so when it is rejected its +/// paragraph is joined into the next one, which takes its properties. fn mark_block(b: &Block, f: &dyn Fn(&mut CharProps), depth: usize) -> Block { match b { Block::Para(p) => { @@ -216,6 +231,7 @@ fn mark_block(b: &Block, f: &dyn Fn(&mut CharProps), depth: usize) -> Block { let len = p.len(); let _ = p.format(0, len, f); f(&mut p.mark); + p.touch(); Block::Para(p) } Block::Table(t) => { diff --git a/crates/engine/src/cmd/tools/tests.rs b/crates/engine/src/cmd/tools/tests.rs index ced4455b7c..c5e45521ea 100644 --- a/crates/engine/src/cmd/tools/tests.rs +++ b/crates/engine/src/cmd/tools/tests.rs @@ -80,6 +80,92 @@ fn compare_marks_an_empty_paragraphs_mark() { assert_eq!(empty_paras(&s), 0, "accepting an empty deleted paragraph left it behind"); } +#[test] +fn compare_keeps_another_authors_deletion_stamp() { + // A paragraph the original already carries as a tracked deletion by another author: Compare + // must keep that author's revision on its runs and on its paragraph mark, not re-attribute + // the block to its own deletion revision. + let mut doc = Document::from_text("A\nOLD\nB"); + doc.revisions.push(wordcraft_doc::Revision::new(RevisionKind::Delete, "Alice", "")); + let p = doc.para_mut(StoryRef::Body, &wordcraft_doc::Path::top(1)).unwrap(); + for r in &mut p.runs { + r.props.del = Some(0); + } + p.mark.del = Some(0); + let mut s = Session::new(doc); + s.run("review.compare", &json!({"text": "A\nB", "author": "Bob"})).unwrap(); + assert_eq!(s.doc.body.len(), 3); + let mid = s.doc.body[1].as_para().unwrap(); + assert_eq!(mid.plain_text(), "OLD"); + assert!(mid.runs.iter().all(|r| r.props.del == Some(0)), "the runs' deletion was re-stamped: {:?}", mid.runs); + assert_eq!(mid.mark.del, Some(0), "the paragraph mark's deletion was re-stamped"); + assert_eq!(s.doc.revisions.first().map(|r| (r.kind, r.author.as_str())), Some((RevisionKind::Delete, "Alice"))); +} + +#[test] +fn compare_pins_the_terminal_inserted_paragraph_limitation() { + // Characterizes the limitation documented on `mark_block` (compare.rs): resolving a revision + // needs a following paragraph, so a paragraph inserted at the very end is rejected but leaves + // one empty paragraph behind. Flip this test when the follow-up fix lands. + let mut s = Session::new(Document::from_text("A\nB")); + s.run("review.compare", &json!({"text": "A\nB\nC"})).unwrap(); + assert_eq!(s.doc.body.len(), 3); + s.run("review.rejectAll", &json!({})).unwrap(); + assert_eq!(s.doc.plain_text(StoryRef::Body), "A\nB\n", "the rejected terminal paragraph still leaves a line"); + assert_eq!(s.doc.body.len(), 3); + assert_eq!(empty_paras(&s), 1, "the rejected terminal paragraph is left as one empty paragraph"); +} + +#[test] +fn compare_pins_the_terminal_deleted_paragraph_limitation() { + // The mirror of `compare_pins_the_terminal_inserted_paragraph_limitation`: a paragraph deleted + // from the very end is accepted but still leaves one empty paragraph. Characterizes the + // limitation documented on `mark_block` (compare.rs); flip when the follow-up fix lands. + let mut s = Session::new(Document::from_text("A\nB\nC")); + s.run("review.compare", &json!({"text": "A\nB"})).unwrap(); + assert_eq!(s.doc.body.len(), 3); + s.run("review.acceptAll", &json!({})).unwrap(); + assert_eq!(s.doc.plain_text(StoryRef::Body), "A\nB\n", "the accepted terminal deletion still leaves a line"); + assert_eq!(s.doc.body.len(), 3); + assert_eq!(empty_paras(&s), 1, "the accepted terminal deletion is left as one empty paragraph"); +} + +#[test] +fn compare_pins_rejecting_an_inserted_section_restyles_the_next_paragraph() { + // Characterizes a known limitation recorded on `mark_block` (compare.rs): rejecting an + // inserted paragraph that carries a section break. `resolve`'s `remove_empty_para` refuses + // paragraphs carrying a section, so once the inserted paragraph's text is rejected the empty + // paragraph is joined into the next one, which takes its properties. Here the original "Body" + // is Heading 1; after Reject All it carries the inserted paragraph's Normal properties. The + // real fix belongs to `resolve` (`remove_empty_para`/`join_next_para`): flip this test when it + // lands. + let mut original = Document::from_text("Intro\nBody"); + original.para_mut(StoryRef::Body, &wordcraft_doc::Path::top(1)).unwrap().props.style = Some("Heading1".into()); + let mut s = Session::new(original); + + let mut rev = Document::from_text("Intro\nAppendix\nBody"); + { + let p = rev.para_mut(StoryRef::Body, &wordcraft_doc::Path::top(1)).unwrap(); + p.props.style = Some("Normal".into()); + p.section = Some(Box::new(wordcraft_doc::section::SectionProps::default())); + } + rev.para_mut(StoryRef::Body, &wordcraft_doc::Path::top(2)).unwrap().props.style = Some("Heading1".into()); + let path = std::env::temp_dir().join(format!("wc-compare-section-{}.docx", std::process::id())); + crate::io::save_path(&path, &rev).unwrap(); + s.run("review.compare", &json!({"path": path.to_string_lossy()})).unwrap(); + let _ = std::fs::remove_file(&path); + s.run("review.rejectAll", &json!({})).unwrap(); + assert_eq!(s.doc.plain_text(StoryRef::Body), "Intro\nBody"); + assert_eq!(s.doc.body.len(), 2); + let body = s.doc.body[1].as_para().unwrap(); + assert_eq!(body.plain_text(), "Body"); + assert_eq!( + body.props.style.as_deref(), + Some("Normal"), + "the current (wrong) outcome: the following paragraph took the inserted sectioned paragraph's properties" + ); +} + #[test] fn compare_options_ignore_case_and_white_space() { let original = "The Cat sat.\nTwo spaces here."; From 791e144fd75ced93dcb97e5ddada8ff6fdbfe4f8 Mon Sep 17 00:00:00 2001 From: Reuben Grinberg Date: Wed, 11 Nov 2026 10:37:12 +0000 Subject: [PATCH 3/7] Compare: flip the inserted-section pin to the fixed behaviour (#5667, fixed on main by #5734) --- crates/engine/src/cmd/tools/tests.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/crates/engine/src/cmd/tools/tests.rs b/crates/engine/src/cmd/tools/tests.rs index c5e45521ea..96c43cb519 100644 --- a/crates/engine/src/cmd/tools/tests.rs +++ b/crates/engine/src/cmd/tools/tests.rs @@ -132,13 +132,14 @@ fn compare_pins_the_terminal_deleted_paragraph_limitation() { #[test] fn compare_pins_rejecting_an_inserted_section_restyles_the_next_paragraph() { - // Characterizes a known limitation recorded on `mark_block` (compare.rs): rejecting an - // inserted paragraph that carries a section break. `resolve`'s `remove_empty_para` refuses - // paragraphs carrying a section, so once the inserted paragraph's text is rejected the empty - // paragraph is joined into the next one, which takes its properties. Here the original "Body" - // is Heading 1; after Reject All it carries the inserted paragraph's Normal properties. The - // real fix belongs to `resolve` (`remove_empty_para`/`join_next_para`): flip this test when it - // lands. + // Pins the fixed behaviour for rejecting an inserted paragraph that carries a section + // break. This was a known limitation recorded on `mark_block` (compare.rs): `resolve`'s + // `remove_empty_para` refused paragraphs carrying a section, so once the inserted + // paragraph's text was rejected the empty paragraph was joined into the next one, which + // took its properties ("Body" came back Normal instead of its original Heading 1). Fixed + // on main by #5734 (issue #5667): `resolve_para` now removes the section break first, so + // the empty paragraph goes whole and the following paragraph keeps its own properties. + // After Reject All the original is restored exactly. let mut original = Document::from_text("Intro\nBody"); original.para_mut(StoryRef::Body, &wordcraft_doc::Path::top(1)).unwrap().props.style = Some("Heading1".into()); let mut s = Session::new(original); @@ -161,8 +162,8 @@ fn compare_pins_rejecting_an_inserted_section_restyles_the_next_paragraph() { assert_eq!(body.plain_text(), "Body"); assert_eq!( body.props.style.as_deref(), - Some("Normal"), - "the current (wrong) outcome: the following paragraph took the inserted sectioned paragraph's properties" + Some("Heading1"), + "the following paragraph keeps its own properties (fixed on main by #5734)" ); } From 959bc5450587c1e91db3094841b1ca4bc82308dd Mon Sep 17 00:00:00 2001 From: Reuben Grinberg Date: Wed, 11 Nov 2026 11:01:19 +0000 Subject: [PATCH 4/7] rustfmt: collapse the flipped pin assertion onto one line --- crates/engine/src/cmd/tools/tests.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/crates/engine/src/cmd/tools/tests.rs b/crates/engine/src/cmd/tools/tests.rs index 96c43cb519..b3f13d6b86 100644 --- a/crates/engine/src/cmd/tools/tests.rs +++ b/crates/engine/src/cmd/tools/tests.rs @@ -160,11 +160,7 @@ fn compare_pins_rejecting_an_inserted_section_restyles_the_next_paragraph() { assert_eq!(s.doc.body.len(), 2); let body = s.doc.body[1].as_para().unwrap(); assert_eq!(body.plain_text(), "Body"); - assert_eq!( - body.props.style.as_deref(), - Some("Heading1"), - "the following paragraph keeps its own properties (fixed on main by #5734)" - ); + assert_eq!(body.props.style.as_deref(), Some("Heading1"), "the following paragraph keeps its own properties (fixed on main by #5734)"); } #[test] From 0345dd28f359ac0dcf9ec51706fbffd5b3c8632e Mon Sep 17 00:00:00 2001 From: Reuben Grinberg Date: Fri, 13 Nov 2026 08:54:06 -0600 Subject: [PATCH 5/7] =?UTF-8?q?Compare:=20mark=5Fblock=20doc=20=E2=80=94?= =?UTF-8?q?=20the=20section-carrying=20case=20is=20fixed=20on=20main=20(#5?= =?UTF-8?q?734),=20not=20a=20limitation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/engine/src/cmd/tools/compare.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/tools/compare.rs b/crates/engine/src/cmd/tools/compare.rs index b298ee4ae5..1dbda83d8e 100644 --- a/crates/engine/src/cmd/tools/compare.rs +++ b/crates/engine/src/cmd/tools/compare.rs @@ -221,9 +221,10 @@ fn block_text(b: &Block, depth: usize) -> String { /// /// Known limitation: resolving a revision needs a following paragraph, so a paragraph inserted at /// the very end (rejected) or deleted from the very end (accepted) still leaves one empty -/// paragraph. That is a separate follow-up, not handled here. A section-carrying inserted paragraph -/// is a second such limitation: `remove_empty_para` refuses it, so when it is rejected its -/// paragraph is joined into the next one, which takes its properties. +/// paragraph. That is a separate follow-up, not handled here. A section-carrying inserted +/// paragraph is not such a case: `resolve_para` removes the section break first (#5734, issue +/// #5667), so rejecting it takes the paragraph out whole and the following paragraph keeps its +/// own properties. fn mark_block(b: &Block, f: &dyn Fn(&mut CharProps), depth: usize) -> Block { match b { Block::Para(p) => { From 17b26e39cc08bde338f5fbc9e39dacff4a89c8fe Mon Sep 17 00:00:00 2001 From: Reuben Grinberg Date: Mon, 16 Nov 2026 20:34:10 -0600 Subject: [PATCH 6/7] Compare: rename the section reject pin to match its assertion; add the accept-side pin (#3750) --- crates/engine/src/cmd/tools/tests.rs | 38 +++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/tools/tests.rs b/crates/engine/src/cmd/tools/tests.rs index b3f13d6b86..c6ddb33bb9 100644 --- a/crates/engine/src/cmd/tools/tests.rs +++ b/crates/engine/src/cmd/tools/tests.rs @@ -131,7 +131,7 @@ fn compare_pins_the_terminal_deleted_paragraph_limitation() { } #[test] -fn compare_pins_rejecting_an_inserted_section_restyles_the_next_paragraph() { +fn compare_pins_rejecting_an_inserted_section_keeps_the_next_paragraphs_style() { // Pins the fixed behaviour for rejecting an inserted paragraph that carries a section // break. This was a known limitation recorded on `mark_block` (compare.rs): `resolve`'s // `remove_empty_para` refused paragraphs carrying a section, so once the inserted @@ -163,6 +163,42 @@ fn compare_pins_rejecting_an_inserted_section_restyles_the_next_paragraph() { assert_eq!(body.props.style.as_deref(), Some("Heading1"), "the following paragraph keeps its own properties (fixed on main by #5734)"); } +#[test] +fn compare_pins_accepting_a_deleted_section_keeps_the_next_paragraphs_style() { + // The Accept-side mirror of `compare_pins_rejecting_an_inserted_section_keeps_the_next_paragraphs_style`: + // compare deletes a paragraph that carries a section break whole (original `A`, `OLD` + // with a section break, `B`; revised `A`, `B`). Accept All goes through the same #5734 + // branch in `resolve_para` as the reject case: the section break is removed first, so + // the emptied paragraph goes whole instead of being joined into the next one. After + // Accept All the revised text stands exactly and `B` keeps its own properties. + let mut original = Document::from_text("A\nOLD\nB"); + { + let p = original.para_mut(StoryRef::Body, &wordcraft_doc::Path::top(1)).unwrap(); + p.props.style = Some("Normal".into()); + p.section = Some(Box::new(wordcraft_doc::section::SectionProps::default())); + } + original.para_mut(StoryRef::Body, &wordcraft_doc::Path::top(2)).unwrap().props.style = Some("Heading1".into()); + let mut s = Session::new(original); + + let mut rev = Document::from_text("A\nB"); + rev.para_mut(StoryRef::Body, &wordcraft_doc::Path::top(1)).unwrap().props.style = Some("Heading1".into()); + let path = std::env::temp_dir().join(format!("wc-compare-section-accept-{}.docx", std::process::id())); + crate::io::save_path(&path, &rev).unwrap(); + s.run("review.compare", &json!({"path": path.to_string_lossy()})).unwrap(); + let _ = std::fs::remove_file(&path); + assert_eq!(s.doc.body.len(), 3); + let mid = s.doc.body[1].as_para().unwrap(); + assert_eq!(mid.plain_text(), "OLD"); + assert!(mid.mark.del.is_some(), "the deleted sectioned paragraph's mark is not marked deleted"); + s.run("review.acceptAll", &json!({})).unwrap(); + assert_eq!(s.doc.plain_text(StoryRef::Body), "A\nB"); + assert_eq!(s.doc.body.len(), 2); + assert_eq!(empty_paras(&s), 0, "accepting the deleted sectioned paragraph left it behind"); + let body = s.doc.body[1].as_para().unwrap(); + assert_eq!(body.plain_text(), "B"); + assert_eq!(body.props.style.as_deref(), Some("Heading1"), "the following paragraph keeps its own properties (fixed on main by #5734)"); +} + #[test] fn compare_options_ignore_case_and_white_space() { let original = "The Cat sat.\nTwo spaces here."; From 110852a3796dc1844afba710ee34ad4c551ac32b Mon Sep 17 00:00:00 2001 From: Reuben Grinberg Date: Mon, 16 Nov 2026 20:34:10 -0600 Subject: [PATCH 7/7] =?UTF-8?q?docs:=20gaps.md=20=E2=80=94=20record=20the?= =?UTF-8?q?=20terminal-paragraph=20compare=20limitation=20(#3750)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/gaps.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/gaps.md b/docs/gaps.md index f67cd79dff..81c1df018d 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -199,6 +199,7 @@ Page Setup's margin, paper-size and document-grid number boxes scroll long text | Date | Change | Summary | |---|---|---| | 2026-11-12 | trivial | Clipboard: a copied picture is published to the system clipboard as PNG, with HTML where the host writes it, and WordCraft's own paste keeps the original fragment; a copy of only shapes stays in WordCraft (#6205). Native external-app paste remains untested. | +| 2026-11-16 | trivial | Compare: a whole-paragraph change at the very end of the body leaves one empty paragraph when resolved — rejecting a terminal inserted paragraph, or accepting a terminal deleted one — because revision resolution needs a following paragraph (#3750; pinned by tests in #5505). No ranked gap changed. | | 2026-11-04 | trivial | #4501 refactor regressions restored: per-section header/footer grid, ODT default font, link tooltip (#4683); no ranked gap changed; readiness estimates unchanged | | 2026-11-08 | trivial | #10 narrowed: a turned inline picture with no recorded effect extent keeps its line to its frame (exchanged near a quarter turn in Word 2013+ layout), cut at the line; gap stays open | | 2026-11-08 | trivial | #4 narrowed: a cell's last Normal paragraph drops its contextual space after, the end-of-cell mark counting as a Normal paragraph (#5450) |