Compare commits

...
Author SHA1 Message Date
autocraft-bot[bot] be5ef437e9 Merge main (f87e9cd6) into the pull request
There was one conflict, in the RTL table row of docs/layout-parity.md. I

There was one conflict, in the RTL table row of docs/layout-parity.md. I kept the pull request's new wording: cell margins stay on the sides they name, and only the left and right borders are mirrored. I also kept the sentence the default branch added about Latin text keeping its digits, spaces and punctuation in order in right-to-left text (#2150). No conflict markers remain anywhere in the tree. I didn't build or run tests, since the only file touched is a doc.
2026-12-02 19:34:57 +00:00
pakiat dfbeffd34a Merge commit 'c369c3a20befef8742f8913128cacd79002435d6' into m/6941
# Conflicts:
#	docs/layout-parity.md
2026-11-23 07:41:25 +07:00
pakiat 514a95b80f Merge commit '6ef13b2cc8a60e6391d7a5b92459ec47598d58a9' into m/6941
# Conflicts:
#	docs/gaps.md
2026-11-18 22:32:58 +07:00
pakiat 01b9ce4b81 Merge commit '22a73d9f2d10de6ee52780ab4a6019b864d9c598' into m/6941
# Conflicts:
#	docs/gaps.md
2026-11-18 06:09:07 +07:00
pakiatandClaude Opus 5.5 b946229d38 Tables: a right-to-left table keeps its cell margins on the sides they name
Measured in Word for Windows 16.0.20527 (modes 14 and 15): in a
w:bidiVisual table a cell's w:left margin stays on its left and w:right on
its right, the cell's (w:tcMar) and the table's (w:tblCellMar) alike, and
w:start/w:end the same. Only the cell's left and right borders are drawn
mirrored. WordCraft mirrored the margins as well, so text in a cell with
unequal margins started 6 to 18 pt off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-17 21:20:23 +07:00
4 changed files with 14 additions and 8 deletions
+5 -3
View File
@@ -648,11 +648,13 @@ pub fn layout_table(ctx: &mut Ctx, story: StoryRef, t: &Table, path: &[u32], ava
let span = cell.span();
let x0 = colx.get(g).copied().unwrap_or(acc);
let x1 = colx.get((g + span).min(ncols)).copied().unwrap_or(acc);
// Right to left: grid columns run from the right edge, and the start (left) margin
// is on the cell's right.
// Right to left: grid columns run from the right edge. The margins stay on the sides
// they name: Word for Windows keeps a cell's `w:left` (or `w:start`) margin on its
// left in a right-to-left table, the cell's and the table's alike, though it draws the
// cell's `w:left` border on its right.
let (x0, x1) = if rtl { ((acc - x1).max(0.0), (acc - x0).max(0.0)) } else { (x0, x1) };
let m = cell.props.resolved_margins(margins_def);
let margins = if rtl { [row_top, m[3], row_bottom, m[1]] } else { [row_top, m[1], row_bottom, m[3]] };
let margins = [row_top, m[1], row_bottom, m[3]];
let cw = (x1 - x0 - margins[1] - margins[3]).max(4.0);
let region = region_of(t, style.as_ref(), ri, g, span, ncols);
// Conditional formatting, later parts winning (ECMA-376 §17.7.6): whole table, column
+6 -4
View File
@@ -564,7 +564,8 @@ fn inline_picture_in_rtl_text_sits_in_its_place() {
/// A right-to-left table (`w:bidiVisual`, #362): the first logical column stands at the right
/// edge, the table is start-aligned against the right margin, and each cell's start (left)
/// margin and border are drawn on its right. Clicks find cells by where they are drawn.
/// border is drawn on its right. Its left margin stays on its left, as Word for Windows lays it
/// out (`w:left` and `w:start` alike). Clicks find cells by where they are drawn.
#[test]
fn rtl_table_lays_its_columns_out_right_to_left() {
crate::test_fonts();
@@ -573,7 +574,7 @@ fn rtl_table_lays_its_columns_out_right_to_left() {
let mut d = Document::from_text("before\nafter");
let mut t = Table::new(1, 3, 300.0);
t.props.bidi_visual = true;
// Start margin 10pt, end margin 2pt.
// Left margin 10pt, right margin 2pt.
t.props.cell_margins = Some([0.0, 10.0, 0.0, 2.0]);
for (i, c) in t.rows[0].cells.iter_mut().enumerate() {
c.blocks = vec![wordcraft_doc::para_block(wordcraft_doc::Paragraph::with_text(&format!("c{i}"), Default::default()))];
@@ -592,10 +593,11 @@ fn rtl_table_lays_its_columns_out_right_to_left() {
assert!(c0.x > c1.x && c1.x > c2.x, "{c0:?} {c1:?} {c2:?}");
assert!((c1.right() - c0.x).abs() < 0.01 && (c2.right() - c1.x).abs() < 0.01);
assert!((c2.x - (right - 300.0)).abs() < 2.0, "{c2:?}");
// The first cell's text sits its end margin (2pt) in from the cell's left edge.
// The first cell's text sits its left margin (10pt) in from the cell's left edge, not its
// right margin (2pt): Word doesn't mirror the margins (measured in Word for Windows).
let text_x =
items.iter().find_map(|i| if let Placed::Lines { path, x, .. } = i { (path.0 == [1, 0, 0, 0]).then_some(*x) } else { None }).unwrap();
assert!((text_x - (c0.x + 2.0)).abs() < 0.5, "text at {text_x}, cell {c0:?}");
assert!((text_x - (c0.x + 10.0)).abs() < 0.5, "text at {text_x}, cell {c0:?}");
// The thick start border is drawn on the cell's right edge.
let thick: Vec<f32> = items
.iter()
+1
View File
@@ -231,6 +231,7 @@ Page Setup's margin, paper-size and document-grid number boxes scroll long text
| 2026-10-31 | trivial | dialogs are dialogs to screen readers, their tabs are tabs, the one shown selected, and colour fields and swatches say their colour |
| 2026-11-01 | trivial | formatting shortcuts say what they did to screen readers |
| 2026-10-30 | trivial | the Paste button is named "Paste" for screen readers, without macOS's key on other platforms; the status bar's Go To hint shows the platform's key |
| 2026-11-17 | trivial | Right-to-left tables (`w:bidiVisual`): a cell's `w:left` and `w:right` margins (or `w:start` and `w:end`, the cell's or the table's) stay on the sides they name, as measured in Word for Windows; only the left and right borders are drawn mirrored; no ranked gap changed |
| 2026-10-30 | trivial | #5: a list item deleted whole under Track Changes shows its number as deleted text, in the deletion's colour and mark, and hides it where deletions are hidden (#4828); estimate unchanged |
| 2026-11-03 | trivial | A picture inserted or pasted in a table cell fits the cell (a nested cell too), in text columns the column, in another section that section, instead of the first section's text width (#5428); a fix, so no ranked gap changed; readiness estimates unchanged |
| 2026-10-26 | trivial | Dialog sections improve readability across 13 dialogs; conditional scrolling keeps tall dialogs usable. Ranked gaps and estimates unchanged (#4035, #4038) |
+2 -1
View File
@@ -95,7 +95,7 @@ Exact line spacing keeps the run font baseline around tall equations; automatic
| Document grid (`w:docGrid`, lines per page, characters per line) | 🟡 | #391, #401: line grid snaps line heights to whole pitches (text centred in them; `w:snapToGrid` off opts a paragraph out); character grid puts East Asian characters on the character pitch (`linesAndChars`) or all text (`snapToChars`), Latin text proportional; View › Gridlines draws it. Not yet: run-level `w:snapToGrid`, grid in headers/footers, paragraph spacing in grid lines, Word's exact glyph placement in a cell | 1–2 |
| Ruby / phonetic guide, enclose characters, combined characters | 🟡 | ruby (Phonetic Guide) landed (#288): ruby text over its base by alignment, line grows to fit, in PDF; enclose and combined characters missing; ruby not yet compared with Word page by page | 2–4 |
| Automatic space between Asian text and Latin text or digits (`w:autoSpaceDE`, `w:autoSpaceDN`) | 🟡 | #2358: a quarter of the Asian character's font size after the first of two touching characters, across runs (measured on Word's PDF of a Chinese document at 16 pt, as JIS X 4051 asks); not beside East Asian punctuation, Hangul, Latin punctuation or an existing space; a field is classed by the text it shows; none at a line's end, none on a character grid the paragraph snaps to (`layout::tests::autospace`). Not yet: justification widening the space as Word does, `autoSpaceLikeWord95` | 1–2 |
| Bidirectional paragraphs, mixed-direction lines; RTL tables and sections | 🟡 | #207; RTL tables (#362): grid columns from the right edge, start alignment and indent from the right margin, cell margins and left/right borders mirrored, merged and turned cells and nested tables included; RTL sections (#362): newspaper columns right to left with the line between mirrored. Latin text keeps its digits, spaces and punctuation in order inside right-to-left text (#2150). Right-hand page gutter (`w:rtlGutter`) missing | 1 |
| Bidirectional paragraphs, mixed-direction lines; RTL tables and sections | 🟡 | #207; RTL tables (#362): grid columns from the right edge, start alignment and indent from the right margin, left/right borders mirrored while cell margins stay on the sides they name (measured in Word for Windows), merged and turned cells and nested tables included; RTL sections (#362): newspaper columns right to left with the line between mirrored. Latin text keeps its digits, spaces and punctuation in order inside right-to-left text (#2150). Right-hand page gutter (`w:rtlGutter`) missing | 1 |
| Equations: display layout, numbering, wrapping long display equations | ✅ | #191; long display equations break at top-level operators (`m:brkBin`, `m:brkBinSub`), manual breaks and `m:alnAt`, continuation lines indented by `m:wrapIndent` or set right (`m:wrapRight`) (#326); an n-ary operator, delimiter, accent or group character the math font lacks is drawn from a fallback font instead of a missing-glyph box (#1273); an equation-array row without `&` is centred among aligned rows, as in Word (#2617) | — |
| Hidden text excluded from breaking and hyphenation | ✅ | #173 | — |
| Empty paragraph with a hidden mark (`w:pPr/w:rPr/w:vanish`) | ✅ | Synthetic DOCX observed in Word for Windows 16.0.20527: no room, no list number, and the number is still counted (`1.`, hidden item, `3.`), in the body and in table cells. `layout::tests::empty_list_paragraph_with_a_hidden_mark_counts_but_shows_nothing`, #3982. Not observed in Word: when such a paragraph closes a section before a continuous one and holds only an in-line picture (or a note reference, or a legacy check box), the picture keeps its room and the next section starts below it instead of over it (`a_hidden_mark_with_an_inline_picture_keeps_its_room`, #5288). A paragraph with text and a hidden mark shown together with the next one (Word) is #3986 | - |
@@ -329,6 +329,7 @@ The front-of-text opt-out is retained from the earlier implementation; this patc
| Date | Change | Summary |
|---|---|---|
| 2026-11-15 | trivial | A paragraph that starts a table cell's part of a page, in a row split across pages (the row continues from the page before, or starts the page, also under repeated header rows and in a nested table), can split even when only one line fits: a lone first line stays, a three-line paragraph with room for two splits two and one, and a lone continuation line stays, instead of keeping nothing so that the row ran off the bottom of the page. A non-exact row marked Can't Split that is taller than a page goes to a new page first when it starts below text, then splits where the page ends, instead of running off it (#6823; measured with synthetic documents in Word for Windows 16.0, compatibility mode 15, widow control on; `layout::tests::table_first_line`). A paragraph below other content of its cell, or in a row that starts below other content of the page, keeps the widow/orphan rule, which matched Word there. Not matched: Word leaves the repeated header off some pages of such a row (observed, no rule found), WordCraft repeats it on every page |
| 2026-11-17 | trivial | Right-to-left tables (`w:bidiVisual`): a cell's `w:left` and `w:right` margins (or `w:start` and `w:end`, the cell's or the table's) stay on the sides they name, as measured in Word for Windows; only the left and right borders are drawn mirrored |
| 2026-10-29 | trivial | A list item deleted whole under Track Changes shows its number in the deletion's colour and with its mark (struck through by default) with markup, and not at all without (#4828) |
| 2026-11-11 | trivial | The line a paragraph shares with the one before, whose mark is hidden, shows that one's shading and borders: the next paragraph's shading and borders no longer cover the text before it and start on its own next line, and what follows the shared line starts below the first one's bottom border. The joined copy keeps the paragraph's revision, so the word being typed in it gets no squiggle and its layouts are reused between passes (#3986) |
| 2026-10-29 | trivial | A paragraph whose mark is hidden is shown on one line with the next one, as in Word: the next paragraph's first line goes on beside its text, on its baseline, without a space before or a list number (still counted), in the body and in table cells, headers and text boxes; clicks on the joined text land in the paragraph it belongs to; a first word that doesn't fit goes on the next line at the paragraph's left indent, and a paragraph moved on to the next column or page is laid out on its own there; the shared line has one line number and stays one block for justified vertical alignment (#3986) |