DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Merge PR #1255: TOC separator and style notation
aiongg35697cb807e8
diff --cc ROADMAP.mdindex 52bfb0f3b,f2ab7bcef..bcb4d01c7--- a/ROADMAP.md+++ b/ROADMAP.md@@@ -460,36 -443,7 +460,37 @@@ Newest first- **2026-10-16** · Lock Guides and Lock Column Guides are commands in View ▸ Grids & Guides (`view.lockGuides`, ⌥⌘;, and `view.lockColumnGuides`), so the control channel and MCP reach them. Lock Column Guides is an undo step, is saved with the document, on in new ones, and read from and written to IDML's `ColumnGuideLocked`, which export always wrote as locked (#1096). No readiness percentage change.- **2026-10-16** · IDML: a page keeps column guides that were dragged off centre (InDesign's Custom columns). They were divided evenly on import, so the gutter sprang back to the middle; the imported positions now place the columns, with the canvas guides, snapping and text placement following them, and they are written back on export. Layout › Margins and Columns re-divides them evenly when the count or gutter changes, as InDesign's does. No readiness percentage change.- **2026-10-16** · IDML: custom column positions are checked before they are used (#1096). A set must give two edges per column, ascending from the left margin to the right one; any other (a wrong count, unsorted or non-numeric values, a list longer than 216 columns allow, or positions left behind by a margin or page-size change) is the even split, in the canvas, on import and on export, instead of columns drawn outside the margins. No readiness percentage change.+- **2026-10-21** · Paragraph Border and Paragraph Shading link their four sides as InDesign's: the stroke weights, offsets and corners have the "Make all settings the same" link, on when the four are the same, so a side typed in sets all four; with the link off a side is set alone (a border with only a thick left side). Found in the Learn Skills Daily course, chapter 40. No readiness percentage change.+- **2026-10-21** · Paragraph rules have InDesign's Type (solid, thick/thin stripes, dashed, dotted, straight hash, wavy, or a stroke style of the document), Gap Color and Gap Tint, and Keep In Frame (rule above); the Paragraph Rules page is laid out as InDesign's (Weight and Type, Color and Tint, Gap Color and Gap Tint, Width and Offset, Left and Right Indent). IDML reads and writes them (`RuleAboveType`, `RuleBelowGapColor`, `KeepRuleAboveInFrame`…). Found in the Learn Skills Daily course, chapter 20. No readiness percentage change.+- **2026-10-21** · New Character Style with text selected starts from what the text has of its own over its paragraph style, as InDesign's ("[None] + Bold + color"), and Apply Style to Selection gives the text the new style, with no override left. A new style's dialog is titled New Paragraph Style / New Character Style. `type.selectionAttrs` reports the text's own character attributes (`ownChars`). Found in the Learn Skills Daily course, chapter 22. No readiness percentage change.+- **2026-10-21** · New Paragraph Style with text selected starts from it, as InDesign's (Based On [No Paragraph Style], every setting of the text that differs) and Apply Style to Selection gives the paragraph the new style; General has Next Style and Reset To Base; Basic Character Formats is in two columns (Size | Leading, Kerning | Tracking, Case | Position). `style.paragraph.edit` honours `nextStyle` (it was ignored) and takes `resetToBase`. Found in the Learn Skills Daily course, chapter 20. No readiness percentage change.+- **2026-10-21** · Find/Change has InDesign's Change Format. Specify Attributes opens Change Format Settings: Style Options (the character and paragraph style to apply, [Any Style] for none), then Basic and Advanced Character Formats, Character Color, OpenType Features, Underline and Strikethrough Options. The box shows the format ("Character Style: eggs"), and Change All gives it to the changed text. With a Change Format and nothing in Change to, the found text stays and is only formatted, as InDesign's (an ⓘ beside Change to says so). `find.change` takes `charStyle` and `paraStyle`. Found in the Learn Skills Daily course, chapter 22. No readiness percentage change.+- **2026-10-21** · Preferences › Interface follows InDesign's: Appearance has a Color Theme swatch per interface theme (a click shows it at once, Cancel goes back) and Panels sets the Tools panel to a single or double column; UI Size moves to a UI Scaling section of its own. Interface held only UI Size, and the theme could be changed only from the Window menu. Found in the Learn Skills Daily course, chapter 26. No readiness percentage change.+- **2026-10-21** · Preferences › File Handling shows Number of Recent Items to Display as a whole number ("20"; it read "20.0"). Found in the Learn Skills Daily course, chapter 26. No readiness percentage change.+- **2026-10-21** · Insert Pages… opens InDesign's dialog: Pages, Insert (After Page, Before Page, At Start of Document, At End of Document) with the page by name, and Parent ([None] or a parent), set to the page in view and its parent. It was a form asking for a page index and a parent id, and pages could not go before the first page; `layout.pages.insert` takes `before` (0: at the start). Found in the Learn Skills Daily course, chapter 25. No readiness percentage change.+- **2026-10-21** · Spelling (Check Spelling and Dynamic Spelling) no longer flags everyday words the bundled hyphenation word list lacks: "we", "us", "if", titles such as "Mr", and words such as email, online, website, database, desktop and download, with their plurals and other forms. Contractions typed with a typographer's apostrophe (don’t, we’re), which Use Typographer's Quotes produces by default, count like their straight-apostrophe forms. Dynamic Spelling used to underline most words of an ordinary sentence. Found in the Learn Skills Daily course, chapter 26. No readiness percentage change.+- **2026-10-21** · While a parent is shown, the status bar's page box and Properties › Page name it ("A-Parent") instead of page 1, as InDesign's; their lists have the parents after the pages, and choosing one shows that parent (a page leaves the parents). Found in the Learn Skills Daily course, chapter 25. No readiness percentage change.+- **2026-10-21** · Effects dialog: the Angle field of the shadows, Bevel and Emboss, Satin and Gradient Feather has InDesign's dial beside it, its radius pointing where the light comes from; a click or drag on it sets the angle. Found in the Learn Skills Daily course, chapter 14. No readiness percentage change.+- **2026-10-21** · A double-click on a Fill or Stroke chip of Properties › Appearance opens the Color Picker with its colour, as in InDesign (a click still opens the swatches); for selected text, its own chips open it for the text. Found in the Learn Skills Daily course, chapter 23. No readiness percentage change.+- **2026-10-20** · Properties › Appearance: with several text frames selected, the Fill and Stroke popups offer Apply To Frame or Text, as with one frame, so their text can be coloured at once, as in InDesign. No readiness percentage change.+- **2026-10-20** · Properties › Appearance: the arrow beside Opacity opens a slider under the field, as in InDesign, instead of the Effects panel; a drag shows the opacity live and is one undo step (the Opacity link still opens Effects). No readiness percentage change.+- **2026-10-20** · Properties › Frame Fitting has InDesign's Auto-Fit checkbox and Options button (Frame Fitting Options); the app's checkboxes are now named and ticked-or-not for screen readers. No readiness percentage change.+- **2026-10-20** · Properties › Text Wrap shows the four wrap offsets under the wrap buttons, with the link that makes them the same, as InDesign's Properties panel does (greyed with no wrap). No readiness percentage change.+- **2026-10-21** · Properties › Bullets and Numbering › Options opens the Bullets and Numbering dialog for the selected paragraphs, as InDesign's, instead of the Paragraph panel. Found in the Learn Skills Daily course, chapter 21. No readiness percentage change.+- **2026-10-20** · Properties › Appearance: the corner shape list shows each shape's glyph beside its name, drawn as InDesign draws them (Fancy has its own glyph now), and the stroke type list shows each type's line; both dropdowns are named for screen readers. No readiness percentage change.+- **2026-10-21** · Properties › Align: the Align To button shows what the objects align to, one glyph each for the selection, the key object, the margins, the page and the spread, as InDesign's. Found in the Learn Skills Daily course, chapter 12. No readiness percentage change.+- **2026-10-20** · Object › Corner Options opens a Corner Options dialog laid out as InDesign's: each corner's size and shape, the link button that makes all four the same, and Preview. The Corner link in Properties › Appearance opens it too (it opened a Rectangle size dialog). No readiness percentage change.+- **2026-10-20** · The Object menu is in InDesign's order and groups; Paths has Join, Open Path and Close Path (Convert Shape lists only shapes, as InDesign's does) and a Convert Point submenu (Plain, Corner, Smooth, Symmetrical) is added. No readiness percentage change.+- **2026-10-20** · Layout › Create Guides puts its guides on both pages of the spread in view, as InDesign does; "This page" in Apply to narrows them to one page. No readiness percentage change.+- **2026-10-21** · Object › Fitting › Clear Frame Fitting Options (`object.clearFittingOptions`): the frames' auto-fit, crop amounts and reference point go back to their defaults, and the picture stays where it is. The Fitting submenu is grouped as InDesign's. Found in the Learn Skills Daily course, chapter 11. No readiness percentage change.+- **2026-10-21** · Swatches panel rows show InDesign's columns, drawn in code: a crossed pencil on the swatches that can't be edited ([None], [Registration], [Black]), the colour type (process or spot) and the colour mode (CMYK, RGB, Gray, or [None]'s and [Registration]'s own glyphs), in place of a lock and "CMYK" text. Tint reads 100 with nothing selected. No readiness percentage change.+- **2026-10-21** · With a gradient fill or stroke, the Color panel shows the stop selected in the Gradient panel (the stop before a selected midpoint) with its values, and its C/M/Y/K or R/G/B sliders and spectrum colour that stop, keeping the others, as in InDesign. It showed "[None] — choose a colour on the ramp", and a spectrum click replaced the whole gradient with a flat colour. Found in the Learn Skills Daily course, chapter 24. No readiness percentage change.+- **2026-10-20** · A new document's Swatches panel lists InDesign's defaults: [None], [Registration], [Paper], [Black] and six process colours (C=100, M=100, Y=100, C=15 M=100 Y=100, C=75 M=5 Y=100, C=100 M=90 Y=10); the extra M=100 Y=100, C=100 Y=100 and C=100 M=100 swatches are gone. No readiness percentage change.+- **2026-10-21** · The readout beside the cursor while drawing or measuring ("W: 3.13 cm") is InDesign's light grey box with white text, measured from the tutorials' frames; High Contrast keeps it black. It was a dark translucent box. No readiness percentage change.+- **2026-10-20** · Drawing a frame or shape shows its width and height in the document's ruler units, to two decimals and on two lines ("W: 6.08 cm", "H: 6.08 cm"), as InDesign does; it was always whole points. No readiness percentage change.+- **2026-10-20** · Type tool: a drag that starts in an empty frame draws a new text frame over it, as in InDesign; a click still turns the frame into a text frame. No readiness percentage change.+- **2026-10-20** · Measures in centimetres show four decimals, as InDesign's fields do (a 1p gutter reads 0.4233 cm, not 0.423 cm). No readiness percentage change.+ - **2026-10-18** · TOC separators preserve right-indent tabs through the dialog and IDML, including localized `$ID/^y` values. A separator picker exposes Tab Character, Right Indent Tab, Em Space and En Space. Existing paragraph tab leaders now work with the tutorial's TOC workflow. No readiness percentage change.- **2026-10-21** · Properties › Character and Paragraph: ••• (More Options) expands the section in place, as InDesign's: Character adds vertical and horizontal scale, baseline shift, skew, language and OpenType, and All Caps, Small Caps, Superscript, Subscript, Underline and Strikethrough; Paragraph adds the left, right, first line and last line indents, space before and after, the drop cap's lines and characters, Align to Baseline Grid and Hyphenate. It used to open the Character or Paragraph panel; the language field moved under ••• as in InDesign. Found in the Learn Skills Daily course, chapter 16. No readiness percentage change.- **2026-10-21** · The text Control panel has InDesign's two modes: A (Character Formatting Controls: font and style, size and leading, All Caps/Superscript/Underline and Small Caps/Subscript/Strikethrough, kerning and tracking, vertical and horizontal scale, baseline shift and skew, character style and language) and ¶ (Paragraph Formatting Controls: the nine alignments, left/first line and right/last line indents, space before and after, the drop cap's lines and characters, paragraph style, Hyphenate and Align to Baseline Grid). It used to show a fixed mix of both. Found in the Learn Skills Daily course, chapter 16. No readiness percentage change.- **2026-10-20** · With the Type tool, the Control panel's font size, leading and tracking fields have a spinner and a list of common values, as in InDesign (auto leading in parentheses). No readiness percentage change.diff --cc crates/engine/src/tests/idml.rsindex 75cea1592,0ef88c521..409f6bdf8--- a/crates/engine/src/tests/idml.rs+++ b/crates/engine/src/tests/idml.rs@@@ -526,8 -525,8 +526,8 @@@ fn table_of_contents_definition_round_tlet basic = designcraft_doc::story::BASIC_PARAGRAPH;s.execute("toc.generate",- &json!({"page": page, "title": "Inside", "titleStyle": basic, "entries": [+ &json!({"page": page, "title": "Inside", "titleStyle": basic, "createBookmarks": true, "entries": [- {"style": "Cover Title", "level": 1, "pageNumber": "before", "separator": " ^ "},+ {"style": "Cover Title", "level": 1, "pageNumber": "before", "separator": " ^ \u{E006} "},{"style": "Headline", "level": 2, "entryStyle": basic, "pageNumber": "none"},]}),)diff --cc crates/idml/src/tests.rsindex 9fa5cd23a,c3b99c790..62928f599--- a/crates/idml/src/tests.rs+++ b/crates/idml/src/tests.rs@@@ -4827,37 -4868,4 +4919,3 @@@ fn epub_split_document_round_trips()assert_eq!(d.settings.epub_split, want, "{attrs}");assert_eq!(import_idml(&export_idml(&d)).unwrap().settings.epub_split, want, "{attrs}");}- }--- /// A TOC style as InDesign writes it: `$ID/`-prefixed separator (`^y`, the right indent tab) and entry style.- const TOC_STYLES: &str = r#"<idPkg:Styles xmlns:idPkg="http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging">- <RootParagraphStyleGroup>- <ParagraphStyle Self="ParagraphStyle/Heading 1" Name="Heading 1"/>- <ParagraphStyleGroup Self="psg-toc" Name="TOC">- <ParagraphStyle Self="ParagraphStyle/TOC%3aTOC body text" Name="TOC:TOC body text" Capitalization="AllCaps"/>- <ParagraphStyle Self="ParagraphStyle/TOC%3aTOC Header" Name="TOC:TOC Header"/>- </ParagraphStyleGroup>- </RootParagraphStyleGroup>- <RootCharacterStyleGroup><CharacterStyle Self="CharacterStyle/TOC Page Number" Name="TOC Page Number"/></RootCharacterStyleGroup>- <TOCStyle Self="TOCStyle/$ID/DefaultTOCStyleName" TitleStyle="ParagraphStyle/TOC%3aTOC Header" Title="Table of Contents" Name="$ID/DefaultTOCStyleName">- <TOCStyleEntry Self="e1" Name="Heading 1" Level="1" PageNumberPosition="AfterEntry" Separator="$ID/^y">- <Properties><FormatStyle type="object">ParagraphStyle/$ID/TOC%3aTOC body text</FormatStyle>- <PageNumberStyle type="object">CharacterStyle/TOC Page Number</PageNumberStyle>- <SeparatorStyle type="string">$ID/[Same Style]</SeparatorStyle></Properties>- </TOCStyleEntry>- </TOCStyle></idPkg:Styles>"#;-- const TOC_STORY: &str = r#"<idPkg:Story xmlns:idPkg="http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging">- <Story Self="s1" AppliedTOCStyle="TOCStyle/$ID/DefaultTOCStyleName"><ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TOC%3aTOC body text"><CharacterStyleRange><Content>Welcome</Content></CharacterStyleRange></ParagraphStyleRange></Story></idPkg:Story>"#;-- #[test]- fn toc_style_entries_read_id_prefixed_separators_and_styles() {- let d = import_idml(&fixture_with_table_styles(TOC_STYLES, TOC_STORY)).unwrap();- let toc = d.toc.as_ref().expect("the story's TOC style is imported");- let entry = toc.entries.iter().find(|e| e.style == "Heading 1").unwrap();- assert_eq!(entry.separator, None, "`$ID/^y` is the right indent tab, the default separator, not text: {:?}", entry.separator);- assert_eq!(entry.entry_style.as_deref(), Some("TOC/TOC body text"));- assert_eq!(entry.page_number_style.as_deref(), Some("TOC Page Number"));- assert_eq!(toc.title_style.as_deref(), Some("TOC/TOC Header"));--}diff --cc crates/ui-egui/src/dialogs.rsindex 253deebd3,674a0cf44..a94043b07--- a/crates/ui-egui/src/dialogs.rs+++ b/crates/ui-egui/src/dialogs.rs@@@ -238,90 -186,40 +238,124 @@@ fn color_theme(app: &DesignApp, ui: &mumod color_theme_tests {use super::*;+ /// A page past the end shows as the last page in the dialog, and Before Page puts the new+ /// page before that one rather than at the end.+ #[test]+ fn insert_pages_before_a_page_past_the_end_goes_before_the_last() {+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({"pages": 4, "facingPages": false})).unwrap();+ let ids = |app: &DesignApp| {+ let d = &app.session.doc().unwrap().doc;+ (0..d.page_count()).map(|i| d.page(i).unwrap().id).collect::<Vec<_>>()+ };+ let old = ids(&app);+ app.ui.dialog = Some(Dialog::new("insertPages", json!({"count": 1, "insert": "before", "page": 100, "parent": ""})));+ confirm(&mut app).unwrap();+ let now = ids(&app);+ assert_eq!(now.len(), 5);+ assert_eq!((now[..3].to_vec(), now[4]), (old[..3].to_vec(), old[3]), "the new page is fourth, before the old last page");+ }++ /// The course's chapter 25: Insert Pages as InDesign's. It opens after the page in view with+ /// that page's parent; At Start of Document with B-Cover puts a B page first, and Before Page+ /// with [None] puts a page without a parent before the page chosen.+ #[test]+ fn insert_pages_goes_before_a_page_or_at_the_start_with_the_chosen_parent() {+ use egui::accesskit::Role;+ use egui_kittest::{Harness, kittest::Queryable};+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ // Facing: [1] [2 3] [4].+ app.run("file.new", json!({"pages": 4})).unwrap();+ let b = app.run("layout.parents.new", json!({"prefix": "B", "name": "Cover"})).unwrap()["id"].as_u64().unwrap();+ let ids = |app: &DesignApp| -> Vec<u64> {+ let d = &app.session.doc().unwrap().doc;+ (0..d.page_count()).map(|i| d.page(i).unwrap().id.0).collect()+ };+ let old = ids(&app);+ crate::menus::activate(&mut app, "layout.pages.insert", &Value::Null);+ assert_eq!(app.ui.dialog.as_ref().unwrap().id, "insertPages");+ let mut h = Harness::builder().with_size(egui::vec2(1000.0, 700.0)).build_ui_state(+ |ui, app: &mut DesignApp| {+ let key = egui::Id::unique("insert_pages_test_fonts");+ if ui.data(|d| d.get_temp::<bool>(key)).is_none() {+ crate::theme::install_fonts(ui.ctx(), "");+ ui.data_mut(|d| d.insert_temp(key, true));+ return;+ }+ show(app, ui.ctx());+ },+ app,+ );+ h.run_steps(3);+ for l in ["Pages:", "Insert:", "Parent:"] {+ assert!(h.query_by_label(l).is_some(), "{l}");+ }+ // The dropdown showing `shown`, then its item `choice`.+ let pick = |h: &mut Harness<'_, DesignApp>, shown: &str, choice: &str| {+ h.get_by(|n| n.role() == Role::ComboBox && n.value().as_deref() == Some(shown)).click();+ h.run_steps(2);+ h.get_by_label(choice).click();+ h.run_steps(2);+ };+ // After page 1 with A, at first; then At Start of Document, with B-Cover.+ pick(&mut h, "After Page", "At Start of Document");+ pick(&mut h, "A-Parent", "B-Cover");+ h.get_by_label(" OK ").click();+ h.run_steps(3);+ assert!(h.state().ui.dialog.is_none());+ let now = ids(h.state());+ assert_eq!(now[1..], old[..], "the new page is first");+ let parent = |app: &DesignApp, i: usize| app.session.doc().unwrap().doc.page(i).unwrap().parent.map(|p| p.0);+ assert_eq!(parent(h.state(), 0), Some(b));+ // Before page 4, with [None].+ crate::dialogs::open_insert_pages(h.state_mut(), 0);+ h.run_steps(3);+ pick(&mut h, "After Page", "Before Page");+ pick(&mut h, "1", "4");+ pick(&mut h, "B-Cover", "[None]");+ h.get_by_label(" OK ").click();+ h.run_steps(3);+ let then = ids(h.state());+ assert_eq!(then.len(), 6);+ assert_eq!(then[..3], now[..3], "the pages before it stay");+ assert_eq!(then[4..], now[3..], "page 4 and those after it follow the new page");+ assert_eq!(parent(h.state(), 3), None);+ }++ #[test]+ fn toc_right_indent_separator_survives_the_dialog_and_update() {+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.newSample", json!({})).unwrap();+ open_toc(&mut app);+ app.ui.dialog.as_mut().unwrap().fields.insert(+ "included".into(),+ json!([+ {"style": "Headline", "level": 1, "separator": " ^y "}+ ]),+ );+ confirm(&mut app).unwrap();+ if app.session.tool_id() == "tocPlace" {+ app.run("toc.place", json!({"x":36,"y":36})).unwrap();+ }+ let separator = format!(" {} ", designcraft_doc::story::RIGHT_INDENT_TAB);+ let d = &app.session.doc().unwrap().doc;+ let toc = d.toc.as_ref().unwrap();+ assert_eq!(toc.entries[0].separator.as_deref(), Some(separator.as_str()));+ assert!(d.story(toc.story).unwrap().text.contains(&separator));+ app.run("toc.update", json!({})).unwrap();+ open_toc(&mut app);+ assert_eq!(toc_rows(app.ui.dialog.as_ref().unwrap())[0].separator, " ^y ");+ for text in ["^y", "^t^y", "^m^>", "unknown ^q and trailing ^", "a\t\u{E006}\u{2003}\u{2002}z"] {+ assert_eq!(toc_separator_typed(&toc_separator_shown(text)), text);+ }+ // The picker after a literal caret: the caret stays, and the code is the code.+ for (field, typed) in [("^", "^\u{E006}"), ("^^", "^\u{E006}"), ("a", "a\u{E006}"), ("^^^", "^^\u{E006}")] {+ let mut f = field.to_string();+ toc_separator_append(&mut f, "^y");+ assert_eq!(toc_separator_typed(&f), typed, "{field:?} → {f:?}");+ }+ }+#[test]fn color_theme_cancel_is_read_only_and_confirm_adds_the_preview() {let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());@@@ -7775,35 -6988,39 +7818,47 @@@ fn toc_dialog(app: &mut DesignApp, ui:crate::rtl::label(ui, egui::RichText::new(format!("{} {}", tr("Style:"), r.style)).font(semibold(12.0)));let none = designcraft_doc::NO_CHAR_STYLE;egui::Grid::new("toc_entry").num_columns(4).spacing([8.0, 6.0]).show(ui, |ui| {- crate::rtl::label(ui, tr("Entry Style:"));+ let name = crate::rtl::label(ui, tr("Entry Style:")).id;let auto = format!("TOC Level {}", r.level.clamp(1, 9));- toc_style_combo(ui, "entry", &styles, &auto, &mut r.entry_style);+ toc_style_combo(ui, "entry", &styles, &auto, &mut r.entry_style, name);ui.end_row();- crate::rtl::label(ui, tr("Page Number:"));+ if !expanded {+ return;+ }+ let page_number = crate::rtl::label(ui, tr("Page Number:")).id;let choices = [("after", "After Entry"), ("before", "Before Entry"), ("none", "No Page Number")];let cur = choices.iter().find(|(v, _)| *v == r.page_number).map_or("After Entry", |(_, l)| l);- craft_ui::ComboBox::from_id_salt("toc_page_number").selected_text(tr(cur)).width(200.0).show_ui(ui, |ui| {- for (v, l) in choices {- if ui.selectable_label(r.page_number == v, tr(l)).clicked() {- r.page_number = v.into();+ craft_ui::ComboBox::from_id_salt("toc_page_number")+ .selected_text(tr(cur))+ .width(200.0)+ .show_ui(ui, |ui| {+ for (v, l) in choices {+ if ui.selectable_label(r.page_number == v, tr(l)).clicked() {+ r.page_number = v.into();+ }}- }- });- crate::rtl::label(ui, tr("Style:"));- toc_style_combo(ui, "page_number", &char_styles, none, &mut r.page_number_style);+ })+ .response+ .labelled_by(page_number);+ let name = crate::rtl::label(ui, tr("Style:")).id;+ toc_style_combo(ui, "page_number", &char_styles, none, &mut r.page_number_style, name);ui.end_row();- crate::rtl::label(ui, tr("Between Entry and Number:"));+ let between = crate::rtl::label(ui, tr("Between Entry and Number:")).id;- ui.add(egui::TextEdit::singleline(&mut r.separator).desired_width(80.0).align(egui::Align2::LEFT_TOP)).labelled_by(between);+ ui.horizontal(|ui| {- ui.add(egui::TextEdit::singleline(&mut r.separator).desired_width(80.0).align(egui::Align2::LEFT_TOP));++ ui.add(egui::TextEdit::singleline(&mut r.separator).desired_width(80.0).align(egui::Align2::LEFT_TOP)).labelled_by(between);+ ui.menu_button("▸", |ui| {+ for (label, code) in [("Tab Character", "^t"), ("Right Indent Tab", "^y"), ("Em Space", "^m"), ("En Space", "^>")] {+ if ui.button(tr(label)).clicked() {+ toc_separator_append(&mut r.separator, code);+ ui.close();+ }+ }+ })+ .response+ .on_hover_text(tr("Insert Special Character"));+ });- crate::rtl::label(ui, tr("Style:"));- toc_style_combo(ui, "separator", &char_styles, none, &mut r.separator_style);+ let name = crate::rtl::label(ui, tr("Style:")).id;+ toc_style_combo(ui, "separator", &char_styles, none, &mut r.separator_style, name);ui.end_row();crate::rtl::label(ui, "");ui.checkbox(&mut r.sort, tr("Sort Entries in Alphabetical Order"));diff --cc crates/ui-egui/src/i18n/ar.rsindex a2d19e1cd,c5167e873..35b86c9fa--- a/crates/ui-egui/src/i18n/ar.rs+++ b/crates/ui-egui/src/i18n/ar.rs@@@ -1,6 -1,6 +1,7 @@@//! Original Arabic interface translations, stored in logical Unicode order.pub(super) const TABLE: &[(&str, &str)] = &[+ ("Fewer Options", "خيارات أقل"),+ ("Tab Character", "محرف جدولة"),("File", "ملف"),("Edit", "تحرير"),("Layout", "تخطيط"),diff --cc crates/ui-egui/src/i18n/cs.rsindex fdb75d7b4,529d7303f..e34d4cfc3--- a/crates/ui-egui/src/i18n/cs.rs+++ b/crates/ui-egui/src/i18n/cs.rs@@@ -3,7 -3,7 +3,8 @@@//! product's localization was used). Phrases shared with the MIT OR Apache-2.0 Czech catalogs of//! the ArtCraft siblings (VectorCraft, PhotoCraft) are kept identical; see ASSETS.md for sources.pub(super) const TABLE: &[(&str, &str)] = &[+ ("Fewer Options", "Méně možností"),+ ("Tab Character", "Znak tabulátoru"),("File", "Soubor"),("Edit", "Úpravy"),("Layout", "Rozvržení"),diff --cc crates/ui-egui/src/i18n/de.rsindex 07a026f55,048f4cdaa..84154a085--- a/crates/ui-egui/src/i18n/de.rs+++ b/crates/ui-egui/src/i18n/de.rs@@@ -3,7 -3,7 +3,8 @@@//! Brazilian Portuguese, Italian and Ukrainian tables has a row here; the German column of the shared//! table is carried over and stays the fallback for keys added there after this table.pub(super) const TABLE: &[(&str, &str)] = &[+ ("Fewer Options", "Weniger Optionen"),+ ("Tab Character", "Tabulatorzeichen"),("File", "Datei"),("Edit", "Bearbeiten"),("Layout", "Layout"),diff --cc crates/ui-egui/src/i18n/it.rsindex d71f2870d,6147cb044..409414d00--- a/crates/ui-egui/src/i18n/it.rs+++ b/crates/ui-egui/src/i18n/it.rs@@@ -1,7 -1,10 +1,11 @@@//! Original Italian interface translations, written from the English source//! using ordinary Italian desktop-publishing vocabulary.pub(super) const TABLE: &[(&str, &str)] = &[+ ("Fewer Options", "Meno opzioni"),+ ("Tab Character", "Carattere di tabulazione"),+ ("Right Indent Tab", "Tabulazione rientro destro"),+ ("Em Space", "Spazio em"),+ ("En Space", "Spazio en"),("File", "File"),("Edit", "Modifica"),("Layout", "Layout"),diff --cc crates/ui-egui/src/i18n/ja.rsindex 761512b83,6909abbcf..5f5c3bb58--- a/crates/ui-egui/src/i18n/ja.rs+++ b/crates/ui-egui/src/i18n/ja.rs@@@ -3,7 -3,7 +3,8 @@@//! Portuguese tables has a row here; the menu titles and panel names that were already Japanese in the//! shared table are carried over unchanged.pub(super) const TABLE: &[(&str, &str)] = &[+ ("Fewer Options", "オプションを減らす"),+ ("Tab Character", "タブ文字"),("File", "ファイル"),("Edit", "編集"),("Layout", "レイアウト"),diff --cc crates/ui-egui/src/i18n/ka.rsindex 5a68e37b0,8e2a50f45..4eab4894e--- a/crates/ui-egui/src/i18n/ka.rs+++ b/crates/ui-egui/src/i18n/ka.rs@@@ -4,7 -4,7 +4,8 @@@//! Portuguese, Japanese, Italian and Ukrainian tables has a row here, plus a few labels that only//! the code or the command table use.pub(super) const TABLE: &[(&str, &str)] = &[+ ("Fewer Options", "ნაკლები პარამეტრი"),+ ("Tab Character", "ტაბულაციის სიმბოლო"),("File", "ფაილი"),("Edit", "რედაქტირება"),("Layout", "განლაგება"),diff --cc crates/ui-egui/src/i18n/pl.rsindex b536be8c7,bbc13c34d..94d45a6d9--- a/crates/ui-egui/src/i18n/pl.rs+++ b/crates/ui-egui/src/i18n/pl.rs@@@ -2,7 -2,7 +2,8 @@@//! are welcome. Terminology follows common Polish DTP usage//! (rozkładówka, łam, strona wzorcowa, obszar informacyjny) and the sibling ArtCraft catalogs.pub(super) const TABLE: &[(&str, &str)] = &[+ ("Fewer Options", "Mniej opcji"),+ ("Tab Character", "Znak tabulacji"),("File", "Plik"),("Edit", "Edycja"),("Layout", "Układ"),diff --cc crates/ui-egui/src/i18n/pt_br.rsindex 505b840ea,2deb7375d..d35b92826--- a/crates/ui-egui/src/i18n/pt_br.rs+++ b/crates/ui-egui/src/i18n/pt_br.rs@@@ -1,7 -1,10 +1,11 @@@//! Original Brazilian Portuguese interface translations, written from the English source//! using ordinary Brazilian Portuguese computing vocabulary.pub(super) const TABLE: &[(&str, &str)] = &[+ ("Fewer Options", "Menos opções"),+ ("Tab Character", "Caractere de tabulação"),+ ("Right Indent Tab", "Tabulação de recuo à direita"),+ ("Em Space", "Espaço eme"),+ ("En Space", "Espaço ene"),("File", "Arquivo"),("Edit", "Editar"),("Layout", "Layout"),diff --cc crates/ui-egui/src/i18n/ru.rsindex 6e8e49df2,fd69cba35..3e16f4093--- a/crates/ui-egui/src/i18n/ru.rs+++ b/crates/ui-egui/src/i18n/ru.rs@@@ -3,7 -3,7 +3,8 @@@//! The translations are our own; counted nouns are genitive plurals because the caption puts the//! category before the number ("страниц: 5"), see `count_label`.pub(super) const TABLE: &[(&str, &str)] = &[+ ("Fewer Options", "Меньше параметров"),+ ("Tab Character", "Символ табуляции"),("File", "Файл"),("Edit", "Редактирование"),("Can't Open the File", "Не удалось открыть файл"),diff --cc crates/ui-egui/src/i18n/uk.rsindex 858e0912e,a21b3cf8a..89755bbd2--- a/crates/ui-egui/src/i18n/uk.rs+++ b/crates/ui-egui/src/i18n/uk.rs@@@ -2,7 -2,10 +2,11 @@@//! Common phrases are adapted from the MIT OR Apache-2.0 ArtCraft sibling catalogs//! (VectorCraft, PhotoCraft, WordCraft and DeckCraft); see ASSETS.md for pinned sources.pub(super) const TABLE: &[(&str, &str)] = &[+ ("Fewer Options", "Менше параметрів"),+ ("Tab Character", "Символ табуляції"),+ ("Right Indent Tab", "Табуляція правого відступу"),+ ("Em Space", "Кругла шпація"),+ ("En Space", "Півкругла шпація"),("File", "Файл"),("Edit", "Редагування"),("Layout", "Макет"),diff --cc docs/ui-parity.mdindex 199bfd45c,560c99f29..a08895086--- a/docs/ui-parity.md+++ b/docs/ui-parity.md@@@ -68,14 -68,14 +68,20 @@@ focused text field, and does not interrcover the cursors, click anchors, scrub/release ownership, restoration, typing guards and undohistory (DC-1).+The Table of Contents title field reserves its edit width inside the title/style row. The+default Contents title is fully visible instead of being clipped to its first few characters.++The Table of Contents dialog can collapse to its entry-style controls or expand to show page+number, separator, sorting and level controls. Toggling visibility preserves their settings.+## Remaining effort+ The Table of Contents separator field accepts `^y` (Right Indent Tab), with a special-character+ picker alongside it. Literal carets use `^^`; ordinary tabs, em/en spaces and surrounding spaces+ survive reopening. IDML preserves right-indent separators, including `$ID/^y`, so updating an+ imported TOC keeps page numbers at the right edge and inherits paragraph tab leaders. This covers+ 10:54–16:08 of [Michael Bullo's TOC tutorial](https://www.youtube.com/watch?v=m4y2tm6LH_c).+Applying a paragraph or character style now removes local values equal to the applied style,so text used to capture a style follows later edits to that style. Different local formattingand named character styles stay intact. Paragraph-style application treats selection endpoints