diff --git a/ROADMAP.md b/ROADMAP.md index 16afcb20d1..249f287f99 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -236,6 +236,7 @@ Ranked, to beta (detail and remaining milestones in [docs/roadmap.md](docs/roadm - 2026-11-03: Size keeps the side it isn't asked to change (#5469): typing only the width of a straight line keeps its height of 0 instead of making it 1 pt; the 1–4000 pt limits apply only to the sides a `picture.size` call changes. Readiness unchanged. - 2026-11-03: Find and Replace: a keyboard apostrophe also finds typographic single quotes, so smart-quoted typing stays searchable (#5388). Regex, wildcards, literal searches and numeric character codes remain exact. Original UTF-8 match ranges and replacement spelling are preserved; readiness unchanged. - 2026-11-03: Security: XLSX import finds each sheet's worksheet part through an index of the workbook's relationships, built once, instead of searching every relationship for every sheet. Readiness unchanged. +- 2026-11-03: Layout: a row of a nested table marked Can't Split isn't split with its outer row any more. The outer row moves to the next page whole when that row comes first in it, as Word does (docxide-pdf `nested-first-row-*-cant1`), and otherwise splits above it (inferred, not yet checked in Word); on a fresh page a nested row taller than the room still splits rather than running into the margin. Readiness unchanged. - 2026-11-03: Security: pasting text boxes charges each copied story for its formatting too (run, mark, paragraph and section properties), not only its text and objects, so a story with huge style or font names can't copy past the paste's 32 MiB text box budget. Readiness unchanged. - 2026-11-03: Security: `.doc` import keeps one width, shading, alignment and merge override per table cell, the last one winning as before, instead of a copy every time a paragraph's properties repeat the sprm, so a shared PAPX can't pile up copies on every paragraph mark. Readiness unchanged. - 2026-11-03: Security: `.doc` import attaches each section to the paragraph that ends it through an index of paragraph ends, instead of scanning every paragraph for every section, so a file with a thousand sections that end nowhere can't multiply the work over its paragraphs. Readiness unchanged. @@ -912,6 +913,7 @@ MATH glyphs that reference the same construction now share its immutable variant | 2026-11-03 | trivial | Progress log: Shape Format › Size in the interface unit (#4196) | | 2026-11-03 | trivial | Find smart-quoted text with a keyboard apostrophe (#5388); exact search modes and replacement spelling preserved. | | 2026-11-03 | trivial | Progress log: a picture in a paragraph whose hidden mark closes a section keeps its room (#5288) | +| 2026-11-03 | trivial | Progress log: a nested table's Can't Split row moves on with its outer row | | 2026-11-03 | trivial | Progress log: Replace and Remove Table of Contents with Word's title above a section break (#4041) | | 2026-11-03 | trivial | Progress log: language-packs-2 published and pinned, 75 Language packs | | 2026-11-02 | trivial | Progress log: language-packs-1 published and pinned, 61 Language packs (CP4.4) | diff --git a/crates/layout/src/table_flow.rs b/crates/layout/src/table_flow.rs index a05680f14a..88757e3368 100644 --- a/crates/layout/src/table_flow.rs +++ b/crates/layout/src/table_flow.rs @@ -94,7 +94,62 @@ fn row_keeps_next(row: &table::RowLayout) -> bool { .unwrap_or(false) } -fn row_can_start(row: &wordcraft_doc::Row, laid: &table::RowLayout, room: f32, page_height: f32) -> bool { +/// The cut that leaves every row of a nested table marked "can't split" whole: just below the +/// top of the highest such row the cut at `room` runs through, moved up again while it runs +/// through another one (Word moves such a row on with the rest of the outer row, observed in the +/// docxide-pdf `nested-first-row-*-cant1` cases). Like the split itself, a row "runs through" +/// the cut when it ends below the room left for text there, above the row's bottom band; the cut +/// goes that band below the row's top, so the text and rows ending at its top stay. +/// shortcut: the moved row's side borders and shading keep that band's height on the page, and +/// on the next page its cell area and shading start that band less its top margin below its +/// first line (clicks there miss the cell). Only an explicit bottom cell margin or a thick outer +/// border shows it, never Word's defaults; upgrade with a separate drawing cut in split_row that +/// moves a nested cell starting between the limit and the cut whole from its top. +fn nested_keep_cut(doc: &wordcraft_doc::Document, row: &table::RowLayout, room: f32) -> f32 { + let own = row.items.iter().filter_map(|it| if let Placed::Cell { table, .. } = it { Some(table.0.len()) } else { None }).min(); + // Each nested row's top and bottom when it can't split. A vertically merged cell runs past + // its own row, so a row ends where its shortest cell does. + let mut bands: std::collections::BTreeMap<(StoryRef, &[u32], usize), Option<(f32, f32)>> = std::collections::BTreeMap::new(); + // The split runs a cell aligned to the middle or bottom from its top: so do its bands. + let mut shift = vec![0.0f32; row.items.len()]; + for al in row.cells.iter().filter_map(|c| c.align.as_ref()) { + shift.get_mut(al.content.clone()).into_iter().flatten().for_each(|d| *d = al.dy); + } + for (it, &dy) in row.items.iter().zip(&shift) { + let Placed::Cell { rect, table, row: r, story, .. } = it else { continue }; + if Some(table.0.len()) <= own { + continue; + } + let rect = Rect { y: rect.y - dy, ..*rect }; + let band = bands + .entry((*story, table.0.as_slice(), *r)) + .or_insert_with(|| doc.table(*story, table).and_then(|t| t.rows.get(*r)).filter(|r| r.props.cant_split).map(|_| (rect.y, rect.bottom()))); + if let Some((top, bottom)) = band { + *top = top.min(rect.y); + *bottom = bottom.min(rect.bottom()); + } + } + let below = row.bottom.clamp(0.0, room.max(0.0)); + let mut bands: Vec<(f32, f32)> = bands.into_values().flatten().collect(); + // From the lowest top up: once the cut moves up to a row, the rows starting below it are + // wholly under it, and a row the old cut ran through still runs through the new one. + bands.sort_by(|a, b| b.0.total_cmp(&a.0)); + let mut cut = room; + for (top, bottom) in bands { + let limit = cut - below; + if top < limit && bottom > limit + 0.01 { + cut = top + below; + } + } + cut +} + +/// [`table::split_row_keeping_cells`] that doesn't split a nested "can't split" row either. +fn split_keeping_nested(doc: &wordcraft_doc::Document, row: &table::RowLayout, room: f32) -> Option<(table::RowLayout, table::RowLayout)> { + table::split_row_keeping_cells(row, nested_keep_cut(doc, row, room)) +} + +fn row_can_start(doc: &wordcraft_doc::Document, row: &wordcraft_doc::Row, laid: &table::RowLayout, room: f32, page_height: f32) -> bool { if laid.height <= room + 0.01 { return true; } @@ -104,7 +159,7 @@ fn row_can_start(row: &wordcraft_doc::Row, laid: &table::RowLayout, room: f32, p if row.props.height_rule == HeightRule::AtLeast && row.props.height.is_some_and(|h| h > room + 0.01 && h <= page_height + 0.01) { return false; } - table::split_row_keeping_cells(laid, room).is_some() + split_keeping_nested(doc, laid, room).is_some() } pub(crate) fn place_table(ctx: &mut Ctx, pb: &mut PageBuilder, t: &wordcraft_doc::Table, block: usize, body_top: f32) { @@ -187,8 +242,7 @@ pub(crate) fn place_table(ctx: &mut Ctx, pb: &mut PageBuilder, t: &wordcraft_doc { let room = pb.bottom - pb.y - tl.rows.iter().take(first).map(|r| r.height).sum::(); let splittable = !t.rows.get(first).is_some_and(|r| r.props.cant_split); - if row.height + row.edge > room + 0.01 && (short_of_min(first, room) || !(splittable && table::split_row_keeping_cells(row, room).is_some())) - { + if row.height + row.edge > room + 0.01 && (short_of_min(first, room) || !(splittable && split_keeping_nested(ctx.doc, row, room).is_some())) { pb.advance(block, body_top); } } @@ -223,7 +277,7 @@ pub(crate) fn place_table(ctx: &mut Ctx, pb: &mut PageBuilder, t: &wordcraft_doc } let (Some(next), Some(laid)) = (t.rows.get(end), tl.rows.get(end)) else { return false }; let page_height = pb.bottom - body_top - repeated_height; - height <= page_height + 0.01 && !row_can_start(next, laid, pb.bottom - pb.y - height, page_height) + height <= page_height + 0.01 && !row_can_start(ctx.doc, next, laid, pb.bottom - pb.y - height, page_height) }); // A row another row follows needs room for the border below it too (measured in Word). if pb.y + cur.height + cur.edge <= pb.bottom + 0.01 && !defer_kept { @@ -238,8 +292,9 @@ pub(crate) fn place_table(ctx: &mut Ctx, pb: &mut PageBuilder, t: &wordcraft_doc let moves_on = first_part && short_of_min(ri, room); let split = match (splittable && !moves_on && !defer_kept, first_part) { (false, _) => None, - (true, true) => table::split_row_keeping_cells(cur, room), - (true, false) => table::split_row(cur, room), + (true, true) => split_keeping_nested(ctx.doc, cur, room), + // On a fresh page, a nested row taller than the room splits rather than overflowing. + (true, false) => table::split_row(cur, nested_keep_cut(ctx.doc, cur, room)).or_else(|| table::split_row(cur, room)), }; match split { Some((a, b)) => { diff --git a/crates/layout/src/tests.rs b/crates/layout/src/tests.rs index 29114735d0..2b1c4eb15b 100644 --- a/crates/layout/src/tests.rs +++ b/crates/layout/src/tests.rs @@ -13,6 +13,7 @@ mod grid; mod ligature; pub(crate) mod linear; mod nbsp; +mod nested_cant_split; mod numeral; mod pages; mod styleref; diff --git a/crates/layout/src/tests/nested_cant_split.rs b/crates/layout/src/tests/nested_cant_split.rs new file mode 100644 index 0000000000..aeccb9901b --- /dev/null +++ b/crates/layout/src/tests/nested_cant_split.rs @@ -0,0 +1,213 @@ +//! A row of a nested table marked "can't split" moves on with its outer row, as in Word +//! (docxide-pdf `nested-first-row-*-cant1`): the outer row splits only above it. +use crate::*; +use wordcraft_doc::{Table, para_block}; + +fn one_line_paras(what: &str, n: usize) -> Vec> { + (0..n) + .map(|i| { + let mut p = Paragraph::with_text(&format!("{what} {i}"), Default::default()); + p.props.space_before = Some(0.0); + p.props.space_after = Some(0.0); + para_block(p) + }) + .collect() +} + +/// A filler paragraph pushed `push` points down, then a one-row table whose cells each hold +/// `prefix` one-line paragraphs and a nested table of one row with `nested` of them. Returns, +/// per cell, the prefix lines and the nested lines on each page. +fn lines_per_page(push: f32, cells: &[(usize, usize)], cant_split: bool) -> Vec<(Vec, Vec)> { + let mut d = Document::from_text("Filler"); + if let Some(Block::Para(p)) = d.body.first_mut().map(Arc::make_mut) { + p.props.space_before = Some(push); + } + let mut outer = Table::new(1, cells.len(), 440.0); + for (cell, &(prefix, nested)) in outer.rows[0].cells.iter_mut().zip(cells) { + let mut inner = Table::new(1, 1, 200.0); + inner.rows[0].props.cant_split = cant_split; + inner.rows[0].cells[0].blocks = one_line_paras("Nested", nested); + cell.blocks = one_line_paras("Prefix", prefix); + cell.blocks.push(Arc::new(Block::Table(inner))); + cell.blocks.push(para_block(Paragraph::with_text("", Default::default()))); + } + d.insert_block(StoryRef::Body, &Path::top(1), Block::Table(outer)).unwrap(); + let mut c = LayoutCache::new(); + let l = layout(&d, &mut c, &LayoutOptions::default()); + let count = |cell: u32, nested: bool| -> Vec { + l.pages + .iter() + .map(|pg| { + pg.items + .iter() + .filter_map(|it| match it { + Placed::Lines { path, l0, l1, .. } => { + let p = &path.0; + let hit = if nested { + p.len() == 7 && p[..3] == [1, 0, cell] && p[4..6] == [0, 0] + } else { + p.len() == 4 && p[..3] == [1, 0, cell] + }; + hit.then_some(l1 - l0) + } + _ => None, + }) + .sum() + }) + .collect() + }; + (0..cells.len() as u32).map(|c| (count(c, false), count(c, true))).collect() +} + +#[test] +fn nested_cant_split_row_moves_on_with_its_outer_row() { + let split = &lines_per_page(520.0, &[(0, 20)], false)[0].1; + assert!(split[0] > 0 && split[1] > 0, "a splittable nested row splits with its outer row: {split:?}"); + assert_eq!(lines_per_page(520.0, &[(0, 20)], true)[0].1[..2], [0, 20], "a can't-split nested row moves on whole"); +} + +#[test] +fn the_outer_row_splits_above_a_nested_cant_split_row() { + // About 22 lines of room: the nested row (lines 10 to 40) runs through it. + let cell = &lines_per_page(340.0, &[(10, 30)], true)[0]; + assert!(cell.0[0] > 0, "the text above the nested row stays: {cell:?}"); + assert_eq!(cell.1[..2], [0, 30], "the nested row moves on whole: {cell:?}"); +} + +#[test] +fn the_cut_moves_up_until_no_nested_cant_split_row_runs_through_it() { + // Room for about 22 lines. Only cell 0's nested row (lines 10 to 40) runs through it; the + // cut at its top then runs through cell 1's (lines 5 to 13), which moves on whole too. + let cells = lines_per_page(340.0, &[(10, 30), (5, 8)], true); + assert_eq!(cells[0].1[..2], [0, 30], "{cells:?}"); + assert_eq!(cells[1].1[..2], [0, 8], "{cells:?}"); + assert!(cells[0].0[0] > 0 && cells[1].0[0] > 0, "the text above both stays: {cells:?}"); +} + +#[test] +fn nested_cant_split_row_taller_than_a_page_still_splits() { + let pages = &lines_per_page(520.0, &[(0, 60)], true)[0].1; + assert_eq!(pages[0], 0, "it leaves the partly filled page: {pages:?}"); + assert_eq!(pages.iter().sum::(), 60, "every line is placed once: {pages:?}"); + assert!(pages.iter().filter(|&&n| n > 0).count() >= 2, "it runs on over pages instead of into the margin: {pages:?}"); +} + +#[test] +fn the_outer_row_breaks_between_nested_cant_split_rows_above_its_bottom_band() { + let mut nested = Table::new(40, 1, 200.0); + nested.props.cell_margins = Some([0.0; 4]); + for (i, row) in nested.rows.iter_mut().enumerate() { + row.props.cant_split = true; + row.cells[0].blocks = one_line_paras(&format!("Row {i}"), 2); + } + let mut outer = Table::new(1, 1, 400.0); + // A bottom margin: the part left on the page keeps it below the last row there. + outer.props.cell_margins = Some([0.0, 5.4, 4.0, 5.4]); + outer.rows[0].cells[0].blocks = vec![Arc::new(Block::Table(nested)), empty()]; + let l = lay_pushed(520.0, outer); + let pages = per_page(&l, |p| p.len() == 7 && p[..4] == [1, 0, 0, 0]); + assert!(pages[0] > 0, "the rows that fit stay on the page: {pages:?}"); + assert_eq!(pages.iter().sum::(), 80, "every line is placed once: {pages:?}"); + for r in 0..40u32 { + let on: Vec = per_page(&l, |p| p.len() == 7 && p[..5] == [1, 0, 0, 0, r]); + assert_eq!(on.iter().filter(|&&n| n > 0).count(), 1, "row {r} stays on one page: {on:?}"); + } +} + +fn empty() -> Arc { + para_block(Paragraph::with_text("", Default::default())) +} + +/// A nested table of one row, marked "can't split", with `lines` one-line paragraphs. +fn kept_nested(lines: usize) -> Arc { + let mut t = Table::new(1, 1, 200.0); + t.rows[0].props.cant_split = true; + t.rows[0].cells[0].blocks = one_line_paras("Nested", lines); + Arc::new(Block::Table(t)) +} + +/// Lay out a filler paragraph pushed `push` points down, then `outer`. +fn lay_pushed(push: f32, outer: Table) -> DocLayout { + let mut d = Document::from_text("Filler"); + if let Some(Block::Para(p)) = d.body.first_mut().map(Arc::make_mut) { + p.props.space_before = Some(push); + } + d.insert_block(StoryRef::Body, &Path::top(1), Block::Table(outer)).unwrap(); + let mut c = LayoutCache::new(); + layout(&d, &mut c, &LayoutOptions::default()) +} + +/// The lines on each page of the body paragraphs whose path `hit` picks. +fn per_page(l: &DocLayout, hit: impl Fn(&[u32]) -> bool) -> Vec { + l.pages + .iter() + .map(|pg| { + pg.items + .iter() + .filter_map(|it| match it { + Placed::Lines { path, l0, l1, .. } => hit(&path.0).then_some(l1 - l0), + _ => None, + }) + .sum() + }) + .collect() +} + +#[test] +fn a_bottom_aligned_cell_keeps_its_nested_cant_split_row_whole() { + // Cell 1 sits at the bottom of the row as laid out, but the split runs it from its top, + // where its nested row (lines 2 to 32) runs through the room of about 22 lines. + let mut outer = Table::new(1, 2, 440.0); + outer.rows[0].cells[0].blocks = one_line_paras("Tall", 50); + outer.rows[0].cells[1].props.valign = Some(wordcraft_doc::props::VAlign::Bottom); + let mut blocks = one_line_paras("Prefix", 2); + blocks.extend([kept_nested(30), empty()]); + outer.rows[0].cells[1].blocks = blocks; + let l = lay_pushed(340.0, outer); + let nested = per_page(&l, |p| p.len() == 7 && p[..4] == [1, 0, 1, 2]); + assert_eq!(nested[..2], [0, 30], "the nested row moves on whole: {nested:?}"); +} + +#[test] +fn header_rows_go_on_with_a_first_row_whose_nested_cant_split_row_comes_first() { + let mut outer = Table::new(2, 1, 400.0); + outer.rows[0].props.header = true; + outer.rows[0].cells[0].blocks = one_line_paras("Header", 1); + outer.rows[1].cells[0].blocks = vec![kept_nested(20), empty()]; + let l = lay_pushed(520.0, outer); + let header = per_page(&l, |p| p == [1, 0, 0, 0]); + assert_eq!(header[0], 0, "the header row doesn't stay alone at the page bottom: {header:?}"); + assert_eq!(per_page(&l, |p| p.len() == 7 && p[..4] == [1, 1, 0, 0])[..2], [0, 20]); +} + +#[test] +fn a_kept_row_goes_on_with_a_row_whose_nested_cant_split_row_cant_start_below_it() { + let mut outer = Table::new(2, 1, 400.0); + let mut kept = one_line_paras("Kept", 1); + if let Some(Block::Para(p)) = kept.first_mut().map(Arc::make_mut) { + p.props.keep_next = Some(true); + } + outer.rows[0].cells[0].blocks = kept; + outer.rows[1].cells[0].blocks = vec![kept_nested(20), empty()]; + let l = lay_pushed(520.0, outer); + let kept = per_page(&l, |p| p == [1, 0, 0, 0]); + assert_eq!(kept[..2], [0, 1], "the kept row moves on with the next one: {kept:?}"); +} + +#[test] +fn a_merged_cell_doesnt_stretch_its_cant_split_row() { + // Row 0 can't split; its first cell is merged down into row 1, which can and runs through + // the room. The cut stays in row 1. + let mut nested = Table::new(2, 2, 300.0); + nested.rows[0].props.cant_split = true; + nested.rows[0].cells[0].props.vmerge = wordcraft_doc::props::VMerge::Restart; + nested.rows[1].cells[0].props.vmerge = wordcraft_doc::props::VMerge::Continue; + nested.rows[0].cells[0].blocks = one_line_paras("Merged", 1); + nested.rows[0].cells[1].blocks = one_line_paras("Short", 1); + nested.rows[1].cells[1].blocks = one_line_paras("Long", 20); + let mut outer = Table::new(1, 1, 400.0); + outer.rows[0].cells[0].blocks = vec![Arc::new(Block::Table(nested)), empty()]; + let l = lay_pushed(520.0, outer); + let long = per_page(&l, |p| p.len() == 7 && p[..6] == [1, 0, 0, 0, 1, 1]); + assert!(long[0] > 0 && long[1] > 0, "the splittable row splits: {long:?}"); +} diff --git a/docs/gaps.md b/docs/gaps.md index 6bef0c7165..cae60f28b0 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -86,6 +86,7 @@ Page drawing indexes text-box warp lookups by paragraph and story for the curren | 4 | **Pagination differs from Word**: Aptos has no metric-matched substitute; legacy compatibility options only partially covered; no page-by-page comparison harness | B | SECTIONPAGES now counts shared continuous-section pages in body and header/footer fields; legacy same-style cell spacing preserved for measured modes 11/12/14, with mode 15 and non-cell controls; Contextual spacing corrected in body/header probes and repeated table-cell runs; [layout-parity.md](layout-parity.md); [typing-parity.md](typing-parity.md) Known gaps; non-overlapping body floating tables clear header tables; stray labels on page-break-only list paragraphs fixed multi-paragraph field-code blank lines fixed; centred numbered heading labels after leading page breaks fixed (#2964); Arial Unicode MS no longer selects monospace substitutes; a slash opening a word travels whole to the next line (#2963) A right, centre or decimal tab whose text doesn't fit, or a left tab past the right indent, goes to the next line with its text, so a TOC entry's page number keeps its leader (#1840). A floating object anchored on a later page of a long paragraph is drawn on that page, also when footnotes or widow control move its line on (#4250); one anchored right after a page break, before text, is drawn on the new page (#4262). Fonts the document uses that aren't installed are flagged in the font box and status bar, except those drawn in a metric-compatible substitute (Carlito for Calibri, Liberation Sans for Arial) and symbol-font text (Symbol, Wingdings, Webdings), so the user knows when line breaks can differ from where the document was made; `font.missing` lists the substituted fonts in the text the current view lays out (capped, for hostile documents), marking the metric-compatible ones `metricCompatible`. | Page counts and line breaks differ, which matters for forms, legal and academic work | 30–50 + owner (font) | [layout-parity.md](layout-parity.md) | | 4 | **Pagination differs from Word**: Aptos has no metric-matched substitute; legacy compatibility options only partially covered; no page-by-page comparison harness | B | SECTIONPAGES now counts shared continuous-section pages in body and header/footer fields; legacy same-style cell spacing preserved for measured modes 11/12/14, with mode 15 and non-cell controls; Contextual spacing corrected in body/header probes and repeated table-cell runs; [layout-parity.md](layout-parity.md); [typing-parity.md](typing-parity.md) Known gaps; non-overlapping body floating tables clear header tables; stray labels on page-break-only list paragraphs fixed multi-paragraph field-code blank lines fixed; centred numbered heading labels after leading page breaks fixed (#2964); Arial Unicode MS no longer selects monospace substitutes; a slash opening a word travels whole to the next line (#2963) A right, centre or decimal tab whose text doesn't fit, or a left tab past the right indent, goes to the next line with its text, so a TOC entry's page number keeps its leader (#1840). Page break before now applies at a continuous section's mid-page top (#5287); the later-column case remains unmeasured in Word. | Page counts and line breaks differ, which matters for forms, legal and academic work | 30–50 + owner (font) | [layout-parity.md](layout-parity.md) | | 4 | **Pagination differs from Word**: Aptos has no metric-matched substitute; legacy compatibility options only partially covered; no page-by-page comparison harness | B | SECTIONPAGES now counts shared continuous-section pages in body and header/footer fields; legacy same-style cell spacing preserved for measured modes 11/12/14, with mode 15 and non-cell controls; Contextual spacing corrected in body/header probes and repeated table-cell runs; [layout-parity.md](layout-parity.md); [typing-parity.md](typing-parity.md) Known gaps; non-overlapping body floating tables clear header tables; stray labels on page-break-only list paragraphs fixed multi-paragraph field-code blank lines fixed; centred numbered heading labels after leading page breaks fixed (#2964); Arial Unicode MS no longer selects monospace substitutes; a slash opening a word travels whole to the next line (#2963); a hyphen before a slash and a letter is also a break opportunity (#3408), while a hyphen before a slash and a digit stays whole A right, centre or decimal tab whose text doesn't fit, or a left tab past the right indent, goes to the next line with its text, so a TOC entry's page number keeps its leader (#1840). | Page counts and line breaks differ, which matters for forms, legal and academic work | 30–50 + owner (font) | [layout-parity.md](layout-parity.md) | +| 4 | **Pagination differs from Word**: Aptos has no metric-matched substitute; legacy compatibility options only partially covered; no page-by-page comparison harness | B | SECTIONPAGES now counts shared continuous-section pages in body and header/footer fields; legacy same-style cell spacing preserved for measured modes 11/12/14, with mode 15 and non-cell controls; Contextual spacing corrected in body/header probes and repeated table-cell runs; [layout-parity.md](layout-parity.md); [typing-parity.md](typing-parity.md) Known gaps; non-overlapping body floating tables clear header tables; stray labels on page-break-only list paragraphs fixed multi-paragraph field-code blank lines fixed; centred numbered heading labels after leading page breaks fixed (#2964); Arial Unicode MS no longer selects monospace substitutes; a slash opening a word travels whole to the next line (#2963); a nested table's Can't Split row moves on with its outer row when the row splits across pages (#5456) A right, centre or decimal tab whose text doesn't fit, or a left tab past the right indent, goes to the next line with its text, so a TOC entry's page number keeps its leader (#1840). | Page counts and line breaks differ, which matters for forms, legal and academic work | 30–50 + owner (font) | [layout-parity.md](layout-parity.md) | | 2 | **Word's native ink is not drawn from its strokes**; OLE objects show only their picture | B | Every native ink form is preserved: drawing-level ink with its optional picture fallback, direct run-level content parts, and ink members of groups and drawing canvases (kept in their place among the members, drawn from their fallback picture). Drawing canvases are read and written (#344); group shapes (`wpg`) read and written (#267). Charts and SmartArt are drawn (#292) and, with OLE objects, written back with all their parts on save (#319) | Pen notes from Word show only as their picture and can't be edited; OLE objects can't be opened | 45–70 to render and edit charts and SmartArt (#13) | [file-format-parity.md](file-format-parity.md) | | 5 | **Content controls** landed (#381): `w:sdt` kept, shown and edited (Developer tab, Design Mode, Properties). Move tracking landed (#400): `w:moveFrom`/`w:moveTo` with their named ranges round-trip, a tracked cut and paste of a paragraph or sentence records a move, either end accepts/rejects both, green double strike/underline markup and "Moved from/to" balloons; Track Changes Options has the Moves rows (Moved from / Moved to mark and colour) and `w:doNotTrackMoves` (Track moves off: a cut and paste is a deletion and an insertion) round-trips; still missing: drag-and-drop moves (no text drag yet). Formatting revisions landed (#41): `w:rPrChange`/`w:pPrChange`/`w:tblPrChange`/`w:trPrChange`/`w:tcPrChange`/`w:sectPrChange`/`w:numberingChange` round-trip, are recorded while tracking, accepted/rejected and shown in balloons; still missing: tracked style-definition changes (table, row, cell and section property changes now record in WordCraft too, #41 follow-up). Opaque custom XML backing stores now survive saves; binding evaluation remains absent. Replace All now checks content-control locks before editing any match; a refused batch preserves the document and undo history. | B | List-label pitch corrected in synthetic metric controls; Issues #41, #400; source grep | Legal and editorial review workflows; templates with form controls | 5–8 | [file-format-parity.md](file-format-parity.md) | | 6 | **Print dialog depth**: desktop printer choice, copies, collation, duplex and grayscale submit through craft-print; File › Print retains preview, page ranges and odd/even (#641) and scales pages to another paper size (#2108); print-only N-up and booklets are available; driver tray/options remain; web prints through the browser (#209) | B | `ui.print` → `apps/wordcraft/src/print.rs`; issue #15 | Everyone who prints | 5–8 | [hardware-parity.md](hardware-parity.md) | @@ -230,6 +231,7 @@ Page Setup's margin, paper-size and document-grid number boxes scroll long text | 2026-10-30 | trivial | #20 narrowed: layout resource caps and linear-time passes (#3867, #3866) | | 2026-10-17 | trivial | UI/UX gaps: copies put RTF on the clipboard (Windows, macOS, Wayland; not X11), and paste reads RTF on macOS and X11 too | | 2026-11-03 | trivial | Find smart-quoted text with a keyboard apostrophe (#5388); exact search modes and replacement spelling preserved. | +| 2026-11-03 | trivial | #4 narrowed: a nested table's Can't Split row moves on with its outer row when the row splits across pages (#5456); Word shows this for a nested row first in its outer row, the split above a later one is inferred and not yet checked in Word; readiness estimates unchanged | | 2026-11-03 | minor | #11: Arabic interface with mirrored shell (#1195); key languages missing are now hi and id (plus pt-PT); Hebrew UI still open | | 2026-11-03 | trivial | #8 (CP4.3): one language list: Set Proofing Language, Review › Language and the status bar offer the Language pack languages (Bulgarian was in none); every published pack named in English; Valencian is `ca-ES-valencia`; gap 8 names built-in proofing | | 2026-11-03 | trivial | #8 (CP4.3): the missing-pack bar offers a language before the list of packs is fetched (a fresh install, or a list cached for an older pin) and gets it on Install; with downloading on, a missing or stale list is fetched once in the background; the caret's typing language counts; the spelling context menu's heading is in the interface language | diff --git a/docs/layout-parity.md b/docs/layout-parity.md index f1833ce0b6..8f57f85b0a 100644 --- a/docs/layout-parity.md +++ b/docs/layout-parity.md @@ -65,7 +65,7 @@ Exact line spacing keeps the run font baseline around tall equations; automatic | Body top below a tall header, footer pushes body up | ✅ | #138; a footer taller than the bottom margin moves the body bottom up (#453), and a header or footer linked to the previous section takes its room too (#454) | — | | Tables: row border exceptions (`w:tblPrEx/w:tblBorders`) | ✅ | `row_borders_stay_on_row`, `row_nil_overrides_style`: explicit cell borders win; row exceptions precede table styles and table borders | — | | Footnotes at the page bottom, endnotes at the end, note numbering | 🟡 | A long note continues onto the next page at a line boundary (its first line stays with the reference), first in that page's note area under a full-width continuation separator (#352); the document's own separator, continuation separator and continuation notice are drawn (the notice under a note that continues); on a page with footnotes a paragraph ending there keeps its space after above the separator, or its last lines go to the next page with the note (#1116); a long endnote continues on the next column or page at a line boundary (#456), and the caret finds note text on its continuation page (#457); each section's note options: footnotes below the text, endnotes at the end of each section, start at, numbering restarted each section or each page (counted from where the notes land, at most three passes) (#385) | 1–2 | -| Tables: row heights (at least/exact), rows split across pages, header rows repeat, Can't Split | ✅ | 2026-10-06, #138; omitted cell-margin edges inherit current table defaults; every cell in a row gets the row's largest top and bottom margin; an exact height covers the top border, top margin and text, the bottom margin comes on top, and an exact row never splits; a row split across pages keeps its cells' bottom margin, border and last space after on the first page, widow/orphan control applies in its cells, each cell continues at the top of the next page and an at-least row keeps its minimum; an at-least row with less room than its minimum on a page that already holds something starts the next page whole (Allow row to break on or off, vAlign centre too), as observed in Word for Mac 2026-10-15 (a row of about 2.6 cm), #1742; that repeated header rows go with it and that a row taller than a page splits from the top of the next page come from the issue and synthetic tests, not a Word check (`…_an_at_least_row_with_no_room_starts_the_next_page_whole_either_way_breaking_is_set`, `…_an_at_least_row_taller_than_a_page_splits_from_the_top_of_the_next_page`, `layout::tests::a_row_shares_its_largest_top_and_bottom_margins`, `…_a_split_row_keeps_its_bottom_margin_and_widow_control`, `…_split_row_cells_each_continue_at_the_top`); a row's `gridAfter` is bounded to 63 columns in native documents too, and repeated header rows stop after 500 000 copied items across a table (hostile documents, #3692); a cell aligned to the middle or bottom of a split row is aligned within the part left on the page when all its text fits there (as tall as the other cells' text there), and runs from the top of the cell otherwise, as measured in Word (`layout::tests::a_middle_or_bottom_cell_of_a_split_row_lines_up_on_the_first_page`); a row whose first part on a page that already holds something would leave a cell empty there, because that cell's first line or inline picture (one line, never split) runs past the room, moves on whole instead of leaving the other cells' text beside the empty cell, so an at-least row grown taller than its minimum by a picture no longer splits off its picture (#4272; inferred from the reporter's Word result and the earlier observation that Word doesn't leave a cell empty for widow control, not yet checked in Word for rows without a minimum; at the top of a page such a row still splits; `layout::tests::an_at_least_row_grown_by_its_picture_moves_on_whole_rather_than_leave_the_picture_behind`, `…_a_picture_row_that_fits_stays_and_text_rows_beside_a_short_picture_still_split`, `…_a_picture_row_too_tall_for_any_page_splits_from_the_top_of_the_next_one`) | — | +| Tables: row heights (at least/exact), rows split across pages, header rows repeat, Can't Split | ✅ | 2026-10-06, #138; omitted cell-margin edges inherit current table defaults; every cell in a row gets the row's largest top and bottom margin; an exact height covers the top border, top margin and text, the bottom margin comes on top, and an exact row never splits; a row split across pages keeps its cells' bottom margin, border and last space after on the first page, widow/orphan control applies in its cells, each cell continues at the top of the next page and an at-least row keeps its minimum; an at-least row with less room than its minimum on a page that already holds something starts the next page whole (Allow row to break on or off, vAlign centre too), as observed in Word for Mac 2026-10-15 (a row of about 2.6 cm), #1742; that repeated header rows go with it and that a row taller than a page splits from the top of the next page come from the issue and synthetic tests, not a Word check (`…_an_at_least_row_with_no_room_starts_the_next_page_whole_either_way_breaking_is_set`, `…_an_at_least_row_taller_than_a_page_splits_from_the_top_of_the_next_page`, `layout::tests::a_row_shares_its_largest_top_and_bottom_margins`, `…_a_split_row_keeps_its_bottom_margin_and_widow_control`, `…_split_row_cells_each_continue_at_the_top`); a row's `gridAfter` is bounded to 63 columns in native documents too, and repeated header rows stop after 500 000 copied items across a table (hostile documents, #3692); a cell aligned to the middle or bottom of a split row is aligned within the part left on the page when all its text fits there (as tall as the other cells' text there), and runs from the top of the cell otherwise, as measured in Word (`layout::tests::a_middle_or_bottom_cell_of_a_split_row_lines_up_on_the_first_page`); a row whose first part on a page that already holds something would leave a cell empty there, because that cell's first line or inline picture (one line, never split) runs past the room, moves on whole instead of leaving the other cells' text beside the empty cell, so an at-least row grown taller than its minimum by a picture no longer splits off its picture (#4272; inferred from the reporter's Word result and the earlier observation that Word doesn't leave a cell empty for widow control, not yet checked in Word for rows without a minimum; at the top of a page such a row still splits; `layout::tests::an_at_least_row_grown_by_its_picture_moves_on_whole_rather_than_leave_the_picture_behind`, `…_a_picture_row_that_fits_stays_and_text_rows_beside_a_short_picture_still_split`, `…_a_picture_row_too_tall_for_any_page_splits_from_the_top_of_the_next_one`); a row of a nested table marked Can't Split isn't split with its outer row: the outer row moves on whole when that row comes first in it (docxide-pdf `nested-first-row-*-cant1`) and otherwise splits above it (inferred, not yet checked in Word), and on a fresh page a nested row taller than the room still splits; `layout::tests::nested_cant_split::nested_cant_split_row_moves_on_with_its_outer_row`, `…::the_outer_row_splits_above_a_nested_cant_split_row`, `…::the_cut_moves_up_until_no_nested_cant_split_row_runs_through_it`, `…::the_outer_row_breaks_between_nested_cant_split_rows_above_its_bottom_band`, `…::a_bottom_aligned_cell_keeps_its_nested_cant_split_row_whole`, `…::header_rows_go_on_with_a_first_row_whose_nested_cant_split_row_comes_first`, `…::a_kept_row_goes_on_with_a_row_whose_nested_cant_split_row_cant_start_below_it`, `…::a_merged_cell_doesnt_stretch_its_cant_split_row`, `…::nested_cant_split_row_taller_than_a_page_still_splits` | — | | Tables: autofit to contents/window, fixed widths, Word 2013 edge | 🟡 | #137; #44: AutoFit Contents measures each column's narrowest and widest text and shares the width like Word, once (not live as you type); consistent a percentage width past 100% is kept, as Word does; a table with its own preferred width keeps it, however far past the margin, and only an automatic-width table over 1.5× the text width is squeezed to the margins (Word squeezes it as soon as it is wider) (#1721); cell widths override stale grid proportions when their totals agree (`cell_widths_override_grid`); conflicting widths and spans still differ | 3–5 | | Floating tables (`w:tblpPr`) | 🟡 | #137; one placed on the page or margin that would cover visible text before it and does not fit below it moves to the next page (#534); empty line-break lines do not count as text; a click below one, outside its cells, goes to the text beside or after it, not to its last row, as checked in Word (#2038); exact line-bottom contact counts for tables only (#3977), both in row-span selection and word skipping; exact-spacing table contact uses the specified height rather than paragraph-mark metrics, with original Source Sans 3 controls in modes 11/12/14/15; expected Word rule from [cyril265's Word for Mac 16.114.1 measurements](https://github.com/storytold/wordcraft/issues/3977#issuecomment-6374217574), not a new Word run of these originals; anchor-order replay remains #3790's scope; other overlap rules untested | 2–3 | | Floating tables (`w:tblpPr`) | 🟡 | #137; one placed on the page or margin that would cover visible text before it and does not fit below it moves to the next page (#534); empty line-break lines do not count as text; a click below one, outside its cells, goes to the text beside or after it, not to its last row, as checked in Word (#2038); the same for a click within 2pt of a cell whose text is turned comes from the issue and synthetic tests, not a check by hand (#4181); other overlap rules untested | 2–3 | @@ -324,6 +324,7 @@ The front-of-text opt-out is retained from the earlier implementation; this patc | 2026-11-02 | trivial | Honor page break before at a continuous section's mid-page top (#5287); its later-column case remains unmeasured in Word. Readiness unchanged. | | 2026-11-03 | trivial | A line breaks after a hyphen before a slash and a letter ("Dataprotection-" / "/Secrecyviolation"), not before a slash and a digit ("fitness-/1589" stays whole, as in Word), so auto-fit table columns no longer widen to the whole compound (#3408) | | 2026-11-03 | trivial | A section's closing paragraph with a hidden mark and only an in-line picture (or a note reference) is not an empty hidden mark: the picture keeps its room, and a continuous section after it starts below it, not over it; not observed in Word (#5288) | +| 2026-11-03 | trivial | A row of a nested table marked Can't Split isn't split with its outer row: the outer row moves on whole when that row comes first in it, and otherwise splits above it (inferred); on a fresh page a nested row taller than the room still splits (docxide-pdf `nested-first-row-*-cant1`) | | 2026-11-01 | trivial | Columns: the line between them runs from the section's top on the page to the bottom of its tallest column; a continuous section mid-page gets its line (#5178) | | 2026-10-31 | trivial | A table row that would leave a cell empty on a page that already holds something (its inline picture or first line runs past the room) moves on whole instead of leaving the other cells' text beside the empty cell; an at-least row grown by its picture no longer splits off the picture (#4272) | | 2026-11-01 | trivial | A cell aligned to the middle or bottom of a row split across pages is aligned within the part left on the page when its text fits there, and starts at the top of the cell otherwise, as measured in Word |