diff --git a/ROADMAP.md b/ROADMAP.md index d449b6cabe..14e1277f0c 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -453,6 +453,7 @@ Imported Word 97–2003 `.doc`/`.dot` files now ask for a supported DOCX target - 2026-10-20: Restrict Editing: with Filling in forms enforced, the Developer tab's content-control buttons and Properties grey out in the ribbon, their tooltips saying why, as in Word; before, they looked live and only refused when clicked. - 2026-10-20: The page tip shown while dragging the vertical scrollbar stays on one line; it broke into two or three lines ("Page 10 of" / "40") as the page number grew during the drag (#3341). - 2026-10-20: Layout: text in Apple's Times and Courier takes Times New Roman's and Courier New's single-line spacing, as in Word for Mac; in a corpus of 180 real manuscripts, the five set in Times no longer gain a page. +- 2026-10-19: The empty window (no document, as after Esc on the Start screen or File › Close) says no document is open in the page area and offers Blank document, Browse… and Home; Home returns to the Start screen without making a document (#3126). - 2026-10-19: Restrict Editing: with Filling in forms enforced, inserting content controls, their Properties and Remove Content Control are refused, as in Word (it greys them out), so a form's fields stay as they are and only their content is filled in. - 2026-10-19: Content controls: text typed over a placeholder takes the control's own run properties (`w:sdtPr/w:rPr`, ECMA-376 §17.5.2.27), as in Word, and the placeholder style is recognised by its built-in name "Placeholder Text" whatever its localized id (German Word: `Platzhaltertext`), so entries in forms from localized Word no longer stay grey. @@ -604,6 +605,7 @@ Imported Word 97–2003 `.doc`/`.dot` files now ask for a supported DOCX target | 2026-10-15 | Rulers: the numbers thin out as the page shrinks on screen (every 1, 2, 4… units, at least 30 px apart, the small ticks at least 4 px apart), give way to the indent, tab and column markers, and the margins get ticks only; both rulers span the caret's page at its own scale in One Page and Multiple Pages and follow the caret to another page (#1878) | | 2026-10-15 | Spelling as you type no longer flags the word being typed; the squiggle comes when the word ends or the caret leaves it, as in Word (#1552) | | 2026-10-15 | Text Highlight Color: No Color becomes the Highlight button's choice, as in Word, so the next click on the button removes highlighting instead of applying the colour picked before; the ribbon and the mini toolbar share one menu (#2105) | +| 2026-10-15 | Design › Paragraph Spacing presets update built-in paragraph styles, so existing styled paragraphs follow the preset; custom paragraph styles keep their own spacing (#1913) | | 2026-10-14 | Insert › Date & Time and DATE, TIME and other date fields show the computer's local date, time and weekday, daylight saving included, as Word does (#1707); they showed UTC, so a user in New Zealand at noon on 31 October got 30 October 23:00. Timestamps saved in files (revisions, comments, document properties) stay UTC. Backstage's greeting follows the local hour too | | 2026-10-14 | DOCX row table border exceptions render and survive saving. Explicit cell borders win; a row exception does not change other rows. | | 2026-10-14 | Tab stops edited on the ruler: the corner selector picks Left/Center/Right/Decimal/Bar, a click sets a stop (Alt skips the snap), dragging moves it with a guide line and position tooltip, dragging off the ruler clears it; markers draw per kind and mirror for RTL; one `para.tabs` call and one undo step per gesture | @@ -969,6 +971,7 @@ Quoted field escapes are interpreted like Word, and body `PAGE` fields use their Section page-numbering settings preserve `w:chapStyle` values across the full unsigned-byte range. MATH glyphs that reference the same construction now share its immutable variants and assembly data (#3630). Glyph mappings, values and the existing partial-record fallback stay unchanged. Repeated glyph IDs keep their last valid reference without retaining superseded constructions. Distinct overlapping constructions and assembly-only sharing remain separate. +- 2026-10-15: Design › Paragraph Spacing presets update built-in paragraph styles, so existing styled paragraphs follow the preset; custom paragraph styles keep their own spacing (#1913). Readiness unchanged. - 2026-10-15: Find opens Navigation on Results; editing the query restores Results after manual Headings/Pages navigation. Typed and selected-text searches retain document contents (#2096). ## Revision history @@ -1229,6 +1232,7 @@ MATH glyphs that reference the same construction now share its immutable variant | 2026-10-20 | trivial | Progress log: the scrollbar page tip stays on one line (#3341) | | 2026-10-20 | trivial | Progress log: Times and Courier take their Windows counterparts' line spacing | | 2026-10-20 | trivial | Progress log: saving to a NAS share mounted by GVFS (#3003) | +| 2026-10-19 | trivial | Empty window (#3126): with no document open (Esc on the Start screen, File › Close), the page area says no document is open and offers Blank document, Browse… and Home; Home goes back to the Start screen without making a document | | 2026-10-19 | trivial | Progress log: Linux display server setting (#2184) | | 2026-10-19 | trivial | Progress log: the status bar's count can be words, characters or characters without spaces (#2797) | | 2026-10-19 | trivial | Text context menus include the existing formatting mini toolbar (#2959); paste options remain in PR #2599. Readiness estimates unchanged. | diff --git a/crates/engine/src/cmd/design.rs b/crates/engine/src/cmd/design.rs index d987411123..c0b4ab3f1c 100644 --- a/crates/engine/src/cmd/design.rs +++ b/crates/engine/src/cmd/design.rs @@ -3,7 +3,7 @@ use serde_json::{Value, json}; use std::sync::Arc; use wordcraft_doc::props::{Border, BorderStyle, Borders, CharProps, LineSpacing, Rgb, TextColor}; -use wordcraft_doc::{Watermark, styles}; +use wordcraft_doc::{StyleKind, Watermark, styles}; use super::sel_result; use crate::{CmdError, CmdResult, CommandSpec, Session, p}; @@ -209,9 +209,16 @@ fn para_spacing(s: &mut Session, v: &Value) -> CmdResult { "double" => (0.0, 8.0, 2.0), _ => (0.0, 8.0, 1.15), }; - Arc::make_mut(&mut s.doc.styles).default_para.space_before = Some(before); - Arc::make_mut(&mut s.doc.styles).default_para.space_after = Some(after); - Arc::make_mut(&mut s.doc.styles).default_para.line_spacing = Some(LineSpacing::Multiple(line)); + let st = Arc::make_mut(&mut s.doc.styles); + let apply = |p: &mut wordcraft_doc::props::ParaProps| { + p.space_before = Some(before); + p.space_after = Some(after); + p.line_spacing = Some(LineSpacing::Multiple(line)); + }; + apply(&mut st.default_para); + for style in st.styles.iter_mut().filter(|style| style.builtin && style.kind == StyleKind::Paragraph) { + apply(&mut style.para); + } sel_result(s) } @@ -295,3 +302,34 @@ fn page_borders(s: &mut Session, v: &Value) -> CmdResult { } sel_result(s) } + +#[cfg(test)] +mod tests { + use super::*; + use serde_json::json; + use wordcraft_doc::{Document, Style}; + + #[test] + fn paragraph_spacing_preset_updates_builtin_styles_and_keeps_custom_styles() { + let mut s = Session::new(Document::new()); + Arc::make_mut(&mut s.doc.styles).styles.push(Style { + id: "CustomSpacing".into(), + name: "Custom Spacing".into(), + kind: StyleKind::Paragraph, + builtin: false, + para: wordcraft_doc::props::ParaProps { space_after: Some(24.0), ..Default::default() }, + ..Default::default() + }); + + s.run("design.paragraphSpacing", &json!({"value": "double"})).unwrap(); + + let normal = s.doc.styles.get("Normal").unwrap(); + assert_eq!(normal.para.line_spacing, Some(LineSpacing::Multiple(2.0))); + let heading = s.doc.styles.get("Heading1").unwrap(); + assert_eq!((heading.para.space_before, heading.para.space_after), (Some(0.0), Some(8.0))); + assert_eq!(heading.para.line_spacing, Some(LineSpacing::Multiple(2.0))); + let custom = s.doc.styles.get("CustomSpacing").unwrap(); + assert_eq!(custom.para.space_after, Some(24.0)); + assert_eq!(custom.para.line_spacing, None); + } +} diff --git a/crates/ui-egui/src/app/frame.rs b/crates/ui-egui/src/app/frame.rs index 2180ff7141..57dc7aae23 100644 --- a/crates/ui-egui/src/app/frame.rs +++ b/crates/ui-egui/src/app/frame.rs @@ -116,7 +116,14 @@ impl WordApp { .top(Slot::new("languagePack").size(SlotSize::Content).visible(language_packs::bar_offer(self)), |_| None, language_packs::pack_bar) .status(true, |_| None, chrome::status_bar::show) .body(|ui, _cx, app: &mut WordApp| { - if !app.has_document() || stale(app) { + if stale(app) { + return; + } + if !app.has_document() { + // The page area offers Blank document, Browse… and Home, so the empty window + // is not a dead end (#3126). The page itself stays empty until one is made or + // opened, as #1129 has it. + crate::canvas::empty_state(app, ui); return; } panes::show(app, ui, |ui, _cx, app| { diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 4a95d6d626..a8a76d7a28 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -28,6 +28,8 @@ use wordcraft_layout::{DocLayout, Page, Placed}; use crate::WordApp; +mod empty; +pub(crate) use empty::empty_state; mod balloons; mod caret; mod column_ruler; diff --git a/crates/ui-egui/src/canvas/empty.rs b/crates/ui-egui/src/canvas/empty.rs new file mode 100644 index 0000000000..e39843c0a5 --- /dev/null +++ b/crates/ui-egui/src/canvas/empty.rs @@ -0,0 +1,39 @@ +//! The page area with no document open (#3126). + +use craft::theme::Variant; +use craft::ui::buttons::Button; +use craft::ui::contract::{Props as _, Show as _, clicked}; +use craft::ui::display::{Shade, Text}; +use egui::Ui; + +use crate::WordApp; + +use super::json; + +/// The page area with no document open (#3126): what to do next, so Esc on the Start screen or +/// File › Close leaves the ways to make or open a document in sight instead of just a greyed-out +/// ribbon that looks broken. The page itself stays empty until one is made or opened, as #1129 +/// has it; Home goes back to the Start screen. +pub(crate) fn empty_state(app: &mut WordApp, ui: &mut Ui) { + let full = ui.available_rect_before_wrap(); + // Centred in the page area, but never pushed off the top of a short window. + ui.add_space(((full.height() - 100.0) * 0.5).max(24.0)); + ui.vertical_centered(|ui| { + Text::new(tl!("No document is open. Create a document or open one first.")).shade(Shade::Muted).id_salt("empty-copy").show(ui); + ui.add_space(16.0); + if clicked(&Button::new(tl!("Blank document")).id_salt("empty-blank").show(ui)) { + let _ = app.run("file.new", json!({"template": "blank"})); + app.canvas.focus_page_after_pass(); + } + ui.add_space(2.0); + if clicked(&Button::new(tl!("Browse…")).id_salt("empty-browse").show(ui)) { + let _ = app.run("ui.openFileDialog", json!({})); + } + ui.add_space(8.0); + // A ghost button, so it reads as a link beside the two actions; the ribbon's Home tab + // is a button above it, so the test takes the lower one with the label. + if clicked(&Button::new(tl!("Home")).variant(Variant::GHOST).id_salt("empty-home").show(ui)) { + let _ = app.run("ui.backstage", json!({"value": true, "page": "home"})); + } + }); +} diff --git a/crates/ui-egui/src/tests/chrome.rs b/crates/ui-egui/src/tests/chrome.rs index ff32dd2b60..3e361ad09a 100644 --- a/crates/ui-egui/src/tests/chrome.rs +++ b/crates/ui-egui/src/tests/chrome.rs @@ -389,6 +389,47 @@ fn blank_document_opens_a_document_from_the_start_screen() { assert!(title.starts_with(&a.title_stem()), "{title}"); } +/// #3126: the empty window (Esc on the Start screen, File › Close) is not a dead end: its +/// page area offers Blank document, Browse… and Home. Home returns to the Start screen and +/// makes nothing; Blank document makes one and the empty state gives way to the page. +#[test] +fn empty_window_offers_ways_to_make_or_open_a_document() { + use egui::accesskit::Role; + use egui_kittest::kittest::Queryable; + let mut a = app(); + a.start_screen(); + let mut h = harness(a); + h.run_steps(4); + h.key_press(egui::Key::Escape); + h.run_steps(4); + assert!(!h.state().has_document() && !h.state().ui.backstage, "the empty window"); + assert!(h.query_by_label("No document is open. Create a document or open one first.").is_some(), "the page area says what to do"); + assert!(h.query_by_role_and_label(Role::Button, "Blank document").is_some(), "Blank document is offered"); + assert!(h.query_by_role_and_label(Role::Button, "Browse…").is_some(), "Browse… is offered"); + // Home in the page area (the ribbon's Home tab shares the label but sits above it) goes + // back to the Start screen and creates no document. + let home = h + .get_all_by_role_and_label(Role::Button, "Home") + .max_by(|a, b| a.rect().top().total_cmp(&b.rect().top())) + .expect("a Home button in the page area"); + home.click(); + h.run_steps(4); + assert!(h.state().ui.backstage && h.state().ui.backstage_page == "home", "Home reaches the Start screen"); + assert!(!h.state().has_document(), "Home alone makes no document"); + h.key_press(egui::Key::Escape); + h.run_steps(4); + // Blank document makes one, ready for typing, and the empty state is gone. + h.get_by_role_and_label(Role::Button, "Blank document").click(); + h.run_steps(4); + assert!(h.query_by_label("No document is open. Create a document or open one first.").is_none(), "the page takes over"); + assert!(h.state().has_document() && !h.state().ui.backstage, "Blank document opens one"); + assert!(h.state().canvas.focused(&h.ctx), "Blank document gives the page the keyboard"); + // Typed through the harness, as a user types, so the text only lands if the page has focus. + h.event(egui::Event::Text("Hello".into())); + h.run_steps(2); + assert_eq!(h.state().session.doc.plain_text(wordcraft_doc::StoryRef::Body).trim(), "Hello"); +} + /// #1129: a template or a file opened from the Start screen (or handed over later) is the /// document; a failed open leaves the window empty. #[test] diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 71cdb152ed..025d26dd75 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -61,7 +61,7 @@ full parity for the area. | Area | Weight | Parity | Was (2026-10-10) | Hours | Evidence and what's missing | |---|---|---|---|---|---| | Typing, selection, clipboard, undo, find/replace | 12 | 85% | 85% | 8–12 | Typing parity pinned by `tests/typing.rs` ([typing-parity.md](typing-parity.md)). Paste Special (#235), Advanced Find (#234) and Column Selection (#237) landed; Clipboard pane landed (#264). **2026-11-28:** Clipboard pane landed (#264, #323). Held at 85%: the port broke caret moves at 255-character runs (#7826) and PopClip copy and paste (#7712); pasting JPG pictures can freeze the UI (#7137). | -| Character and paragraph formatting | 11 | 84% | 82% | 8–12 | Nearly every property, Font/Paragraph dialogs, character border, Phonetic Guide (#288), Enclose Characters (#297). Kerning for fonts in the Font dialog. Missing: stylistic-set options in the Font dialog's Advanced tab. **2026-11-28:** Up: OpenType ligatures from `w14:ligatures` (#2351) and the Asian Typography tab (#323) landed. | +| Character and paragraph formatting | 11 | 84% | 82% | 8–12 | Nearly every property, Font/Paragraph dialogs, character border, Phonetic Guide (#288), Enclose Characters (#297); Design › Paragraph Spacing presets update built-in paragraph styles (#1913). Kerning for fonts in the Font dialog. Missing: stylistic-set options in the Font dialog's Advanced tab. **2026-11-28:** Up: OpenType ligatures from `w14:ligatures` (#2351) and the Asian Typography tab (#323) landed. | | Styles and themes | 8 | 77% | 74% | 8–12 | Gallery, pane, create/modify, style sets, themes. Style Inspector landed (#236). Missing: style separators, linked-style edge cases; Word ships 11 Quick Style sets plus dozens of themes, we ship our own smaller set. **2026-11-28:** Up: Manage Styles landed (#270, #323). Style separators still missing; the port changed the Styles gallery look (#7678, #7679). | | Lists | 6 | 78% | 78% | 5–8 | Bullets, numbering, multilevel, restart, `w:lvlOverride` levels (#134), Word's list AutoFormat and Enter/Backspace behaviour. Missing: Define New Multilevel List dialog depth, list styles, legal numbering edge cases. **2026-11-28:** No change: no landed work on the missing items found. | | Tables | 8 | 78% | 76% | 10–16 | Merge/split, styles (cell text takes style formatting, #104), custom table styles saved in the .docx (#256), Word 2013 edge, floating tables, rows split across pages, sort, formula, cell gridlines (#243), Draw Table and Eraser (#303), tables nested 18 deep at most, so a .json save or AutoRecover snapshot reads back even with rich content in the deepest cell (#1596, #3618; the .docx reader and writer keep 24; Word has no limit). Cell Margins opens an editable dialog initialized from table defaults and preserves unchanged values (#1960). Missing: splitting or erasing around vertically merged cells, nested-table polish. Dragging column and row borders and the resize handle on the page (#217) and the column and row markers on the rulers (#700) landed, with Word's Ctrl, Alt, left-edge and selected-cells drags (#711), and so did selecting columns, rows and cells, the "+" insert buttons, the move handle and double-click AutoFit on the page, Select Column, and drags and Shift+arrows over cells selecting whole cells; right-clicking a cell offers the table's commands, following the selection as in Word (Delete Cells, Rows, Columns or Table, Merge and Split Cells, Distribute, AutoFit, Text Direction, Insert Caption…, Table Properties…); cell text direction landed (#245). **2026-11-28:** Up: Split Cells on merged cells and Convert Text to Table dialogs (#2592, #2913), table paste into cells (#6742). Open: Convert Text to Table drops section breaks (#5548, critical). | @@ -336,6 +336,7 @@ can be used without committing Word output. | 2026-10-10 | minor | Stage checked against the core-workflow alpha gate: passes, stays alpha | | 2026-10-10 | major | Created from ROADMAP.md's "Parity by area" and "Estimate to 100%" sections; full re-measure against Word for Mac 16.113.4 (bundle listing, catalog diff from source, issue tracker); split into feature depth (67%) and ready for real work (60%); added proofing, East Asian, accessibility areas and the dimension table; hours re-calibrated from PR history | | 2026-10-06 | major | First estimate in ROADMAP.md: ~62% real feature parity, 120–150 h to 100% | +| 2026-10-15 | trivial | Character and paragraph formatting: Design › Paragraph Spacing presets update built-in paragraph styles (#1913); no percentage change | | 2026-10-29 | trivial | Tables row: Table Properties' row, column and cell settings apply to the selection, as in Word (#4857); no percentage change | | 2026-11-07 | trivial | Proofing: freestanding custom dictionary file support (plain UTF-8 and Word CUSTOM.DIC UTF-16LE with BOM) in File › Options › Proofing (#5840); no percentage change | | 2026-11-28 | minor | Refreshed against the 28 Nov parity run (#7969): catalog coverage 510 / 522 (97.7%); commands, tests and lines of code re-counted from source; open issue and PR counts updated. The percentage estimates are unchanged: they predate the craft-ui port (#7101), whose regressions are tracked in epic #7671, and are being re-measured. | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 0f96531bca..5049f003cd 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -248,6 +248,7 @@ Page Setup's margin, paper-size and document-grid number boxes scroll long text | 2026-10-16 | trivial | Update Field is offered on a table of contents after it was saved and reopened (a range field then), including at its first and last character; repeated save and update no longer adds a blank line (#2182; the flow in that report already worked since #1197) | | 2026-10-18 | trivial | Different First Page: double-clicking page 1's header while editing another one goes into page 1's own; Insert › Header/Footer/Page Number and Edit Header/Footer use the header the caret's page shows (first, even or default) instead of always the default (#2826) | | 2026-10-15 | trivial | Track Changes Options › Moves: Moved from and Moved to rows (mark and colour; green double strikethrough and double underline by default, as in Word for Mac, which has no Track moves checkbox). `review.trackingOptions {"moveFromMark", "moveFromColor", "moveToMark", "moveToColor"}`, saved per user; `"trackMoves"` sets the document's setting. Mark lists in Word for Mac's order; Deletions and Moved from gain (none), Bold, Italic and Double underline; moved text marked (none) is plain text | +| 2026-10-15 | trivial | Design › Paragraph Spacing presets update built-in paragraph styles, so existing styled paragraphs follow the preset (#1913) | | 2026-10-14 | trivial | Comments pane and balloons: a comment or reply edit the document refuses keeps the typed text and shows why; drafts belong to their document, so a new or opened one never shows them; Save, Export, Print, Close, New and Open write pending drafts first; a refused draft doesn't block them (Save saves the rest, Close/New/Open ask Save / Don't Save / Cancel about it); Escape discards a draft; comment and reply fields are read-only in a document protected as read only or for forms (#1348) | | 2026-10-17 | trivial | Language dialog keeps inherited proofing language and no-proof choices (#2717); readiness estimates unchanged | | 2026-10-15 | trivial | Selection bar: the right margin for right-to-left paragraphs and tables, and the page margin beside table rows selects rows (click, drag, Shift+click) | @@ -434,6 +435,7 @@ labels unambiguous. Those extra-number assignments have not been compared with W | 2026-10-25 | trivial | Customize Ribbon, Quick Access Toolbar and Customize Keyboard pickers: filter-as-you-type command search across all commands (label or id, case-insensitive); clearing restores the category scope (#1845) | | 2026-10-29 | trivial | Table Properties: the Row, Column and Cell settings apply to every selected row, column and cell, as in Word, not to the caret's alone, so selecting the whole table and unticking Allow row to break across pages keeps every row whole; Allow row to break and Repeat as header row show as mixed when the selected rows differ and change nothing until clicked; the row-height rule box has an accessible name (#4857) | | 2026-10-27 | trivial | File › Options › Proofing › AutoCorrect Options opens its dialog with no document open (Start screen); it did nothing there (#4585) | +| 2026-10-19 | trivial | Empty window (#3126): with no document open (Esc on the Start screen, File › Close), the page area says no document is open and offers Blank document, Browse… and Home; Home goes back to the Start screen without making a document | ### Format Painter integration refresh, 2026-10-30