Compare commits

..
44 changed files with 392 additions and 1039 deletions
+3 -3
View File
@@ -4,10 +4,10 @@
"repository_id": 1408489772,
"producer_workflow_id": 429734489,
"producer_workflow_path": ".github/workflows/nightly.yml",
"producer_tooling_revision": "main",
"producer_workflow_ref": "storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@main",
"producer_tooling_revision": "bf94b15b708089b95c4e2d1c978e66ecf1f2f4f3",
"producer_workflow_ref": "storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@bf94b15b708089b95c4e2d1c978e66ecf1f2f4f3",
"signer_workflow_path": ".github/workflows/nightly-sign.yml",
"signer_tooling_revision": "main",
"signer_tooling_revision": "bf94b15b708089b95c4e2d1c978e66ecf1f2f4f3",
"release_branch": "nightly-signer",
"manual_actors": [
"bflatastic",
+6 -6
View File
@@ -44,10 +44,10 @@ jobs:
- name: Install the system libraries the GUI links
run: sudo apt-get update && sudo apt-get install -y pkg-config libxkbcommon-dev libwayland-dev libx11-dev libxcursor-dev libxrandr-dev libxi-dev libgtk-3-dev libfontconfig1-dev libfreetype-dev
- name: Check out craft-fonts
uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main
uses: storytold/craft-common-actions/actions/checkout-craft-fonts@f5141455aac7b2eb4708aa259d8ffcdf10fde939
with:
ref: b076417b5880bd4154bd22f00695b1d28c6bea83
- uses: storytold/craft-common-actions/actions/checkout-craft-i18n@main
- uses: storytold/craft-common-actions/actions/checkout-craft-i18n@f5141455aac7b2eb4708aa259d8ffcdf10fde939
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: stable
@@ -128,10 +128,10 @@ jobs:
with:
persist-credentials: false
- name: Check out craft-fonts
uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main
uses: storytold/craft-common-actions/actions/checkout-craft-fonts@f5141455aac7b2eb4708aa259d8ffcdf10fde939
with:
ref: b076417b5880bd4154bd22f00695b1d28c6bea83
- uses: storytold/craft-common-actions/actions/checkout-craft-i18n@main
- uses: storytold/craft-common-actions/actions/checkout-craft-i18n@f5141455aac7b2eb4708aa259d8ffcdf10fde939
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: stable
@@ -188,10 +188,10 @@ jobs:
with:
persist-credentials: false
- name: Check out craft-fonts
uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main
uses: storytold/craft-common-actions/actions/checkout-craft-fonts@f5141455aac7b2eb4708aa259d8ffcdf10fde939
with:
ref: b076417b5880bd4154bd22f00695b1d28c6bea83
- uses: storytold/craft-common-actions/actions/checkout-craft-i18n@main
- uses: storytold/craft-common-actions/actions/checkout-craft-i18n@f5141455aac7b2eb4708aa259d8ffcdf10fde939
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: stable
+2 -2
View File
@@ -34,9 +34,9 @@ jobs:
checks: read
attestations: write
id-token: write
uses: storytold/craft-common-actions/.github/workflows/nightly-release.yml@main
uses: storytold/craft-common-actions/.github/workflows/nightly-release.yml@bf94b15b708089b95c4e2d1c978e66ecf1f2f4f3
with:
tooling-revision: main
tooling-revision: bf94b15b708089b95c4e2d1c978e66ecf1f2f4f3
app-name: wordcraft
producer_run_id: ${{ inputs.producer_run_id }}
producer_run_attempt: ${{ inputs.producer_run_attempt }}
+2 -3
View File
@@ -22,9 +22,9 @@ jobs:
actions: read
attestations: write
id-token: write
uses: storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@main
uses: storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@bf94b15b708089b95c4e2d1c978e66ecf1f2f4f3
with:
tooling-revision: main
tooling-revision: bf94b15b708089b95c4e2d1c978e66ecf1f2f4f3
app-name: wordcraft
manual-actors: '["bflatastic","dylanmtaylor","echelon","FredApps","skylartaylor"]'
craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83
@@ -32,4 +32,3 @@ jobs:
# craft-common-actions main commit that merged the exact-analysis admission (#371, after #370,
# #369 and #364).
platforms: '["windows-x86_64","linux-x86_64","macos-aarch64"]'
linux-package-formats: '["deb","rpm","appimage","flatpak","oci","arch"]'
+1 -22
View File
@@ -10,7 +10,7 @@ use wordcraft_geom::Rect;
use crate::boxes::BoxContext;
use crate::para::{CellText, ClKind, ParaLayout};
use crate::{BoxInput, BoxLayout, Ctx, Placed, ViewMode, layout_box};
use crate::{BoxInput, BoxLayout, Ctx, Placed, layout_box};
/// Largest preferred table width, as a share of the text column, that a file can ask for.
const MAX_WIDTH_SHARE: f32 = 10.0;
@@ -431,12 +431,6 @@ fn table_frame(ctx: &mut Ctx, t: &Table, avail: f32, depth: usize, style: Option
grid.iter_mut().for_each(|w| *w *= k);
total = avail;
}
// The reading view reflows to its column, so even a table with its own width fits it (#7988).
if ctx.opts.view == ViewMode::Read && total > avail && avail > 0.0 {
let k = avail / total;
grid.iter_mut().for_each(|w| *w *= k);
total = avail;
}
if !t.props.fixed {
// Measuring lays paragraphs out once more; it mustn't count their equations twice.
let eq_count = ctx.eq_count;
@@ -483,14 +477,6 @@ fn table_frame(ctx: &mut Ctx, t: &Table, avail: f32, depth: usize, style: Option
} else {
indent - first_cell_left_margin_in(t, margins_def)
};
// The reading view fits the table into what the start offset leaves of the column, mirrored or not (#7988).
let room = (avail - start_offset.max(0.0)).max(1.0);
if ctx.opts.view == ViewMode::Read && acc > room && !matches!(t.props.align, Some(Align::Center | Align::Right)) {
let k = room / acc;
colx.iter_mut().for_each(|c| *c *= k);
acc = room;
total = room;
}
let x = match (t.props.align, rtl) {
(Some(Align::Center), _) => (avail - total) / 2.0,
// End alignment: the right margin, or the left one in a right-to-left table.
@@ -499,13 +485,6 @@ fn table_frame(ctx: &mut Ctx, t: &Table, avail: f32, depth: usize, style: Option
(_, true) => avail - total - start_offset,
(_, false) => start_offset,
};
// The reading view has no margin to hang a negative indent into: keep the table inside the column (#8020).
// The clamp also pulls in an over-large positive indent. A table wider than the column keeps its start edge.
let x = if ctx.opts.view == crate::ViewMode::Read {
if total > avail { if rtl { avail - total } else { 0.0 } } else { x.clamp(0.0, avail - total) }
} else {
x
};
TableFrame { ncols, colx, acc, total, margins_def, tborders, rtl, x }
}
-58
View File
@@ -660,31 +660,6 @@ fn reading_layout_reflows_into_viewport_height_pages_without_changing_print_layo
assert!(invalid.pages.iter().all(|p| p.w.is_finite() && p.h.is_finite()));
}
#[test]
fn reading_layout_fits_a_wide_table_to_the_column() {
crate::test_fonts();
// #7988: a 468 pt table is wider than a reading column but must not run past its edge, however it is indented or mirrored.
let cases = [(0.0, false, None), (36.0, false, None), (36.0, true, None)];
let aligned = [None, Some(Align::Left), Some(Align::Center), Some(Align::Right)].map(|a| (36.0, false, a));
let aligned_rtl = [Some(Align::Left), Some(Align::Right)].map(|a| (36.0, true, a));
for (indent, rtl, align) in cases.into_iter().chain(aligned).chain(aligned_rtl) {
let mut d = Document::from_text("Before.");
let mut t = Table::new(2, 4, 468.0);
t.props.indent = Some(indent);
t.props.bidi_visual = rtl;
t.props.align = align;
d.insert_block(StoryRef::Body, &Path::top(1), wordcraft_doc::Block::Table(t)).unwrap();
let opts = LayoutOptions { view: ViewMode::Read, web_width: 360.0, read_height: 600.0, ..Default::default() };
let l = layout(&d, &mut LayoutCache::new(), &opts);
let p = &l.pages[0];
let cells: Vec<_> = p.items.iter().filter_map(|i| if let Placed::Cell { rect, .. } = i { Some(*rect) } else { None }).collect();
let (left, right) = cells.iter().fold((f32::MAX, 0.0f32), |(l, r), c| (l.min(c.x), r.max(c.x + c.w)));
assert!(right > left, "cells placed");
assert!(right <= p.body.x + p.body.w + 0.5, "indent {indent} rtl {rtl} {align:?}: right {right} vs column {}", p.body.x + p.body.w);
assert!(left >= p.body.x - 0.5, "indent {indent} rtl {rtl} {align:?}: left {left} vs column {}", p.body.x);
}
}
#[test]
fn hit_and_caret_agree() {
crate::test_fonts();
@@ -17824,36 +17799,3 @@ fn header_text_covers_the_whole_band_of_centred_and_right_lines() {
assert!(hit(x + left - 60.0), "{align:?}: beyond 40pt left of the band the picture is hit");
}
}
#[test]
fn reading_layout_keeps_a_negatively_indented_table_in_the_column() {
crate::test_fonts();
// #8020: a table indented left of the margin ran out of the column's start edge (right edge when mirrored).
for (rtl, width, indent, align) in [
(false, 300.0, -36.0, None),
(true, 300.0, -36.0, None),
(true, 400.0, -36.0, None),
(false, 400.0, -36.0, None),
(false, 300.0, -36.0, Some(Align::Center)),
] {
let mut d = Document::from_text("Before.");
let mut t = Table::new(2, 4, width);
t.props.indent = Some(indent);
t.props.bidi_visual = rtl;
t.props.align = align;
d.insert_block(StoryRef::Body, &Path::top(1), wordcraft_doc::Block::Table(t)).unwrap();
let opts = LayoutOptions { view: ViewMode::Read, web_width: 360.0, read_height: 600.0, ..Default::default() };
let l = layout(&d, &mut LayoutCache::new(), &opts);
let p = &l.pages[0];
let cells: Vec<_> = p.items.iter().filter_map(|i| if let Placed::Cell { rect, .. } = i { Some(*rect) } else { None }).collect();
let (left, right) = cells.iter().fold((f32::MAX, 0.0f32), |(l, r), c| (l.min(c.x), r.max(c.x + c.w)));
assert!(right > left, "cells placed");
// A table wider than the column keeps its start edge there; one that fits is inside at both edges.
if !rtl || width <= 300.0 {
assert!(left >= p.body.x - 0.5, "rtl {rtl} width {width}: left {left} vs column {}", p.body.x);
}
if rtl || width <= 300.0 {
assert!(right <= p.body.x + p.body.w + 0.5, "rtl {rtl} width {width}: right {right} vs column {}", p.body.x + p.body.w);
}
}
}
+1 -2
View File
@@ -250,8 +250,7 @@ fn side_menu(ui: &mut Ui, band: f32, current: &str, has_document: bool, show_dis
.least_width(LeastWidth::SideMenu)
.surface(SurfaceKind::Brand)
.label(label("File"))
// v0.19.1's row pitch (~42 pt against the 38 pt rows): the theme's tight gap between the page rows.
.gap(Gap::Tight)
.gap(Gap::None)
.scroll(Scroll::vertical())
.header(move |ui, _| {
ui.add_space(band);
+2 -4
View File
@@ -748,7 +748,7 @@ fn about_stays_at_the_bottom_of_a_side_menu_that_fits() {
}
/// The side menu is production's rail: 200 pt wide (five rail columns, `LeastWidth::SideMenu`), its page rows about
/// 38 pt tall a tight gap apart. The footer's links are rows of the same place, so they read in the rail's white ink;
/// 38 pt tall one after another. The footer's links are rows of the same place, so they read in the rail's white ink;
/// production's were a little shorter (32 pt), which the side menu place has no row for.
#[test]
fn the_side_menu_rows_are_production_s_rail_rows() {
@@ -758,9 +758,7 @@ fn the_side_menu_rows_are_production_s_rail_rows() {
// The least width holds in the row beside the page: before, the row gave the menu only its widest name (~123 pt).
assert!((190.0..=260.0).contains(&info.width()), "the menu is production's 200 pt rail: {info:?}");
assert!((34.0..=44.0).contains(&info.height()), "a page row is a rail row: {info:?}");
// v0.19.1's pitch was ~42 pt for 38 pt rows: the rows are a little apart, not touching and not far apart.
let gap = recover.min.y - info.max.y;
assert!((1.0..=8.0).contains(&gap), "the rows have a small gap between them: {info:?} {recover:?}");
assert!((recover.min.y - info.max.y).abs() < 1.0, "the rows follow each other without a gap: {info:?} {recover:?}");
assert!(about.height() <= info.height() + 1.0, "the footer link is no taller than a page row: {info:?} {about:?}");
}
+1 -10
View File
@@ -716,17 +716,8 @@ fn show_reading(app: &mut WordApp, ui: &mut Ui, layout: &Arc<DocLayout>, full: R
let mut state = std::mem::take(&mut app.canvas.reading);
let source = source::WordPages::new(app, layout, false, None);
let out = ReadingView::new(tl!("Document"), &source, &mut state, paper).zoom(zoom).show_at(ui, columns);
// The page-turn row sits at the bottom right, as in v0.19.1 (the far end, so the bottom left in a right-to-left UI),
// the page view's side margin in from the edge.
let margin = Env::of(ui).tokens.space.inset.page_side;
let footer = footer.shrink2(egui::vec2(margin, 0.0));
let far = if crate::i18n::current().rtl() {
egui::Layout::left_to_right(egui::Align::Center)
} else {
egui::Layout::right_to_left(egui::Align::Center)
};
let nav = ui
.scope_builder(egui::UiBuilder::new().max_rect(footer).layout(far), |ui| {
.scope_builder(egui::UiBuilder::new().max_rect(footer), |ui| {
ReadingNav::new(&mut state, layout.pages.len()).position(true).action(tl!("Edit Document")).show(ui)
})
.inner;
+1 -14
View File
@@ -56,7 +56,7 @@ impl Component for ReadingProbe {
fn measure(&mut self, cx: &MeasureCx<'_, Self>) -> egui::Vec2 {
let measure = ReadingMeasure::of(TypeRole::Body, |run| cx.layout(run));
self.measured = Some(metrics(cx.style.column_gap, cx.style.nav_bar, measure));
self.measured = Some(ReadingMetrics::new(cx.style.column_gap, cx.style.nav_bar, measure));
egui::Vec2::ZERO
}
@@ -69,19 +69,6 @@ impl Component for ReadingProbe {
}
}
/// Column widths Read Mode has always used (about one column per 295 screen points, none under 192), as v0.19.1 laid out 4
/// columns at 1440 screen points. craft's body-text measure (66 characters) gives 2 there, so only the gaps come from it.
const COLUMN_TARGET: f32 = 295.0;
const COLUMN_MIN: f32 = 192.0;
fn metrics(column_gap: f32, nav_bar: f32, measure: ReadingMeasure) -> ReadingMetrics {
let mut m = ReadingMetrics::new(column_gap, nav_bar, measure);
// lean: fixed px, not the text size; follow the body text again if Read Mode should scale with it.
m.column_target = COLUMN_TARGET;
m.column_min = COLUMN_MIN;
m
}
/// The reading metrics under the current theme, or `None` when the probe did not measure this pass.
pub(super) fn read(ui: &mut Ui) -> Option<ReadingMetrics> {
ReadingProbe { common: Common::new(), measured: None }.label("Reading metrics").show(ui).metrics
-42
View File
@@ -253,48 +253,6 @@ fn drawing_over_the_pages_follows_the_read_mode_page_color() {
assert_eq!(blank(&a), Rgb::WHITE, "the paper under the raster, not the page color");
}
/// #8019: at 1440 x 900 Read Mode lays out several narrow columns (v0.19.1: 4), not the two the body
/// text's measure gave after the port.
#[test]
fn read_mode_lays_out_several_columns_at_1440() {
let mut a = WordApp::new(wordcraft_engine::Session::new(wordcraft_doc::Document::from_text("Hello WordCraft")), Default::default());
a.run("view.readMode", json!({})).unwrap();
let mut h = crate::test_harness::builder().with_size(egui::vec2(1440.0, 900.0)).build_ui_state(
|ui, app: &mut WordApp| {
let ctx = ui.ctx().clone();
app.logic(&ctx);
app.ui(ui);
},
a,
);
h.run_steps(4);
let px = ReadingView::screen_scale(1.0) * h.state().session.view.read_width;
assert!(px > 0.0 && 4.0 * px < 1440.0, "columns {px} px wide: four do not fit");
}
/// #8019: the page-turn row (position and Edit Document) sits in the bottom-right quadrant, as in v0.19.1,
/// not at the bottom left where craft's row starts.
#[test]
fn read_mode_pager_is_at_the_bottom_right() {
use egui_kittest::kittest::Queryable;
let mut a = WordApp::new(wordcraft_engine::Session::new(wordcraft_doc::Document::from_text("Hello WordCraft")), Default::default());
a.run("view.readMode", json!({})).unwrap();
let mut h = crate::test_harness::builder().with_size(egui::vec2(1440.0, 900.0)).build_ui_state(
|ui, app: &mut WordApp| {
let ctx = ui.ctx().clone();
app.logic(&ctx);
app.ui(ui);
},
a,
);
h.run_steps(4);
let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1440.0, 900.0));
for label in ["Edit Document", "1 / 1"] {
let r = h.get_all_by_label(label).last().unwrap().rect();
assert!(r.center().x > screen.center().x && r.center().y > screen.center().y, "{label} at {r:?}: not bottom right");
}
}
/// #299: the caret's colour is worked out only when the caret is drawn: with text selected
/// there is no caret, so the page's draw list isn't built for it.
#[test]
+11 -11
View File
@@ -6,9 +6,10 @@ use craft::ui::buttons::Button;
use craft::ui::choice::{Radio, RadioGroup};
use craft::ui::contract::{Bind, Entry, Props as _, Show as _, ShowContainer as _, clicked};
use craft::ui::dialog::DialogId;
use craft::ui::display::{Picture, PictureSize, Text};
use craft::ui::display::{Picture, Text};
use craft::ui::form::FieldGroup;
use craft::ui::layout_components::Row;
use craft::ui::list::{ThumbAspect, ThumbSize};
use craft::ui::list::ThumbAspect;
use craft::ui::patterns::form_dialogs::FormCx;
use craft::ui::primitives::{ContentPainterCx, TextureCache};
use craft::ui::runtime::env::Label;
@@ -19,7 +20,7 @@ use wordcraft_doc::props::Align;
use super::dialogs_insert::symbol::SymbolRequest;
use super::font::FontRequest;
use super::host::{Asks, ChildAnswer, WordForm, captioned, open_form};
use super::host::{Asks, ChildAnswer, WordForm, open_form};
use crate::WordApp;
/// The alignments the dialog offers: `para.defineBullet`'s `align` and their names.
@@ -182,7 +183,6 @@ impl DefineBulletForm {
}
},
)
.extent(PictureSize::Sample(ThumbSize::Large))
}
}
@@ -210,8 +210,8 @@ impl WordForm for DefineBulletForm {
});
let entries: Vec<Entry<String>> = ALIGNMENTS.iter().map(|(k, n)| Entry::new((*k).to_string(), Label::from(tl!(n)))).collect();
let current = if self.align.is_empty() { "left".to_string() } else { self.align.clone() };
let group = captioned(ui, Label::from(tl!("Alignment:")), |name, ui| {
RadioGroup::new(name, Bind::given(current.clone())).show(ui, |ui, _| {
FieldGroup::new(Label::from(tl!("Alignment:"))).show(ui, |ui, _| {
let group = RadioGroup::new(Label::from(tl!("Alignment:")), Bind::given(current.clone())).show(ui, |ui, _| {
Row::new().show(ui, |ui, _| {
for e in &entries {
if let (Some(id), label) = (e.value(), e.label()) {
@@ -219,12 +219,12 @@ impl WordForm for DefineBulletForm {
}
}
});
})
});
if let Some(a) = group.output.value().cloned() {
self.align = a;
}
});
if let Some(a) = group.and_then(|g| g.output.value().cloned()) {
self.align = a;
}
captioned(ui, Label::from(tl!("Preview")), |_, ui| {
FieldGroup::new(Label::from(tl!("Preview"))).show(ui, |ui, _| {
self.preview().show(ui);
});
self.ch.chars().count() == 1
@@ -4,11 +4,10 @@ use craft::text::ui::columns::{ColumnsApply, TextColumns, TextColumnsDialog};
use craft::ui::choice::{Radio, RadioGroup};
use craft::ui::contract::{Bind, FieldLayout, Props as _, Show as _, ShowContainer as _, SideLabel};
use craft::ui::dialog::DialogId;
use craft::ui::form::Field;
use craft::ui::form::{Field, FieldGroup};
use craft::ui::layout_components::Stack;
use craft::ui::patterns::form_dialogs::FormCx;
use craft::ui::runtime::env::Label;
use craft::ui::sections::GroupBox;
use craft::ui::text::NumberField;
use egui::Ui;
use serde::{Deserialize, Serialize};
@@ -16,7 +15,7 @@ use serde_json::{Map, Value, json};
use super::{settled, word};
use crate::WordApp;
use crate::dialogs::host::{Asks, DialogHooks, Keyed, Settle, WordForm, captioned, open_with};
use crate::dialogs::host::{Asks, DialogHooks, Keyed, Settle, WordForm, open_with};
use crate::options::lengths;
use crate::widgets::font_box::{CatalogRef, font_picker};
@@ -105,16 +104,14 @@ impl WordForm for DropCapForm {
fn body(&mut self, ui: &mut Ui, _cx: &mut FormCx<'_, '_>, _asks: &mut Vec<Asks>) -> bool {
let enabled = self.position != "none";
Stack::new().show(ui, |ui, _| {
captioned(ui, word("Position"), |name, ui| {
RadioGroup::new(name, Bind::bound(&mut self.position)).show(ui, |ui, _| {
Stack::new().show(ui, |ui, cx| {
for (at, (v, l)) in [("none", "None"), ("dropped", "Dropped"), ("margin", "In margin")].into_iter().enumerate() {
cx.labelled(ui, at, word(l), SideLabel::new().layout(FieldLayout::After), Radio::new(v.to_string()));
}
});
})
RadioGroup::new(word("Position"), Bind::bound(&mut self.position)).show(ui, |ui, _| {
Stack::new().show(ui, |ui, cx| {
for (at, (v, l)) in [("none", "None"), ("dropped", "Dropped"), ("margin", "In margin")].into_iter().enumerate() {
cx.labelled(ui, at, word(l), SideLabel::new().layout(FieldLayout::After), Radio::new(v.to_string()));
}
});
});
GroupBox::new(word("Options"), None).show(ui, |ui, _| {
FieldGroup::new(word("Options")).show(ui, |ui, _| {
if let Some(catalog) = self.catalog.get() {
Field::new(word("Font:")).show(ui, |ui, _| {
font_picker(word("Font:"), Bind::bound(&mut self.font), catalog, Bind::bound(&mut self.settings), &[], None)
@@ -3,7 +3,6 @@ use std::sync::Arc;
use craft::behavior::{ColumnWidth, Selection, SelectionChange, keyed};
use craft::font_manager::Catalog;
use craft::font_manager::picker::FontPickerSettings;
use craft::theme::Mode;
use craft::ui::contract::{Bind, CollectionEvent, ColumnKey, ColumnSpec, SelectMode, Show as _, ShowCollection as _, ShowContainer as _};
use craft::ui::dialog::{DialogId, DialogResult, DialogStack, HeldAnswer, HeldOk, StackDialog, dialog_id};
use craft::ui::display::{Kbd, Text};
@@ -12,7 +11,7 @@ use craft::ui::layout_components::Stack;
use craft::ui::list::{ListRow, ThumbAspect, ThumbSize};
use craft::ui::patterns::form_dialogs::{FormCx, FormDialog};
use craft::ui::primitives::ContentPainterCx;
use craft::ui::runtime::env::{Env, Label};
use craft::ui::runtime::env::Label;
use craft::ui::table::Table;
use craft::ui::tabs::{Tab, TabKind, TabStrip};
use craft::ui::tile_grid::{CaptionPlace, Tile, TileGrid};
@@ -547,7 +546,7 @@ fn special_table(ui: &mut Ui, form: &mut SymbolForm) -> bool {
let columns = vec![
ColumnSpec::new(glyph.clone(), Label::Empty, ColumnWidth::fill(0.5)),
ColumnSpec::new(name.clone(), word("Special Characters"), ColumnWidth::fill(2.0)),
ColumnSpec::new(keys.clone(), word("Shortcut key:"), ColumnWidth::Controls(5.5)),
ColumnSpec::new(keys.clone(), word("Shortcut key:"), ColumnWidth::fill(1.0)),
];
let positions: Vec<usize> = (0..SPECIAL.len()).collect();
let source = keyed(&positions, |at: &usize| *at);
@@ -615,8 +614,7 @@ fn symbol_page(ui: &mut Ui, form: &mut SymbolForm, catalog: Option<&Arc<Catalog>
{
form.jump_to(name);
}
// The theme's mode, not egui's `dark_mode`, which the craft theme does not drive (light tiles in the light theme, #8021).
let dark = Env::of(ui).view().mode() == Mode::Dark;
let dark = ui.visuals().dark_mode;
let activated = glyph_grid(ui, form, dark);
recent_row(ui, form, dark);
if let Some(c) = form.selected {
+12 -31
View File
@@ -15,7 +15,7 @@ use egui::Ui;
use serde_json::Value;
use crate::WordApp;
use crate::dialogs::host::{DialogHooks, labelled, open_form, open_form_with};
use crate::dialogs::host::{DialogHooks, open_form, open_form_with};
mod page;
pub(crate) mod print;
@@ -92,23 +92,11 @@ pub(crate) fn points() -> LengthUnits {
LengthUnits::new(UnitKind::Points, UnitKind::Points, 96.0)
}
/// A whole-number field over `value` within `range`, with its caption; true when the user changed it.
/// A whole-number field over `value` within `range`; true when the user changed it.
pub(crate) fn count_field(ui: &mut Ui, label: &str, value: &mut u32, range: RangeInclusive<u32>, enabled: bool) -> bool {
labelled(ui, label.to_string(), |name, ui| count_box(ui, name, value, range.clone(), enabled)).unwrap_or(false)
}
/// `count_field` with no caption, named `label` for assistive technology: for a box that follows a radio carrying the
/// same words ("Start at:").
pub(crate) fn count_box(
ui: &mut Ui,
label: impl Into<craft::ui::runtime::env::Label>,
value: &mut u32,
range: RangeInclusive<u32>,
enabled: bool,
) -> bool {
let was = f64::from(*value);
let mut shown = Some(was);
NumberField::new(label, Bind::bound(&mut shown)).range(f64::from(*range.start())..=f64::from(*range.end())).enabled(enabled).show(ui);
NumberField::new(label.to_string(), Bind::bound(&mut shown)).range(f64::from(*range.start())..=f64::from(*range.end())).enabled(enabled).show(ui);
match shown {
Some(n) if n != was => {
*value = (n.round().max(0.0) as u32).clamp(*range.start(), *range.end());
@@ -128,10 +116,8 @@ pub(crate) fn length_field(ui: &mut Ui, label: &str, value: &mut f32, lengths: L
let was = f64::from(*value);
// The form takes the field's edit events, not a write into a copy that lives one pass: an edit that commits as the
// dialog files its OK (Enter, or a click on OK) reaches the form in the pass that files it.
let out = labelled(ui, label.to_string(), |name, ui| {
NumberField::length(name, Bind::given(Some(was)), lengths).range(range.clone()).enabled(enabled).show(ui)
});
match out.as_ref().and_then(|out| edited(&out.edit.events)) {
let out = NumberField::length(label.to_string(), Bind::given(Some(was)), lengths).range(range).enabled(enabled).show(ui);
match edited(&out.edit.events) {
Some(n) if n != was => {
*value = n as f32;
true
@@ -143,8 +129,8 @@ pub(crate) fn length_field(ui: &mut Ui, label: &str, value: &mut f32, lengths: L
/// A percentage field over `value`; true when the user changed it.
pub(crate) fn percent_field(ui: &mut Ui, label: &str, value: &mut f32, range: RangeInclusive<f64>) -> bool {
let was = f64::from(*value);
let out = labelled(ui, label.to_string(), |name, ui| NumberField::new(name, Bind::given(Some(was))).range(range.clone()).unit("%").show(ui));
match out.as_ref().and_then(|out| edited(&out.edit.events)) {
let out = NumberField::new(label.to_string(), Bind::given(Some(was))).range(range).unit("%").show(ui);
match edited(&out.edit.events) {
Some(n) if n != was => {
*value = n as f32;
true
@@ -165,16 +151,11 @@ pub(crate) fn named_field<K: NumberName + 'static>(
enabled: bool,
) {
let presets = vec![Entry::new(NumberPick::Choice(name.0.id()), name.1.to_string()).checked(matches!(*value, NamedOr::Named(_)))];
labelled(ui, label.to_string(), |name, ui| {
{
let field = NumberField::named(name, Bind::bound(&mut *value)).range(range.clone()).presets(&presets).enabled(enabled);
match lengths {
Some(lengths) => field.lengths(lengths),
None => field,
}
}
.show(ui)
});
let mut field = NumberField::named(label.to_string(), Bind::bound(value)).range(range).presets(&presets).enabled(enabled);
if let Some(lengths) = lengths {
field = field.lengths(lengths);
}
field.show(ui);
}
/// The number a named field holds, 0 while it holds its name.
@@ -14,7 +14,7 @@ use serde_json::{Value, json};
use wordcraft_engine::cmd::objects::fit_size;
use super::{DialogId, WordApp, length_field, percent_field, points};
use crate::dialogs::host::{Asks, FormHost, WordForm, captioned, labelled};
use crate::dialogs::host::{Asks, FormHost, WordForm};
// ---------------------------------------------------------------------------------------------
// Size
@@ -300,22 +300,14 @@ impl WordForm for PageNumbersForm {
fn body(&mut self, ui: &mut Ui, _cx: &mut FormCx<'_, '_>, _asks: &mut Vec<Asks>) -> bool {
let formats: Vec<Entry<String>> =
crate::dialogs_notes::FORMATS.iter().map(|(v, l)| Entry::new((*v).to_string(), tl!(l).to_string())).collect();
labelled(ui, tl!("Number format").to_string(), |name, ui| Select::new(name, Bind::bound(&mut self.format), &formats).show(ui));
captioned(ui, tl!("Page numbering").to_string(), |name, ui| {
RadioGroup::new(name, Bind::bound(&mut self.cont)).show(ui, |ui, _| {
Stack::new().show(ui, |ui, cx| {
cx.labelled(
ui,
0,
Label::from(tl!("Continue from previous section")),
SideLabel::new().layout(FieldLayout::After),
Radio::new(true),
);
cx.labelled(ui, 1, Label::from(tl!("Start at:")), SideLabel::new().layout(FieldLayout::After), Radio::new(false));
});
})
Select::new(tl!("Number format").to_string(), Bind::bound(&mut self.format), &formats).show(ui);
RadioGroup::new(tl!("Page numbering").to_string(), Bind::bound(&mut self.cont)).show(ui, |ui, _| {
Stack::new().show(ui, |ui, cx| {
cx.labelled(ui, 0, Label::from(tl!("Continue from previous section")), SideLabel::new().layout(FieldLayout::After), Radio::new(true));
cx.labelled(ui, 1, Label::from(tl!("Start at:")), SideLabel::new().layout(FieldLayout::After), Radio::new(false));
});
});
super::count_box(ui, tl!("Start at:"), &mut self.start, 0..=100_000, !self.cont);
super::count_field(ui, tl!("Start at:"), &mut self.start, 0..=100_000, !self.cont);
true
}
@@ -12,7 +12,7 @@ use wordcraft_engine::cmd::mailings::{ENVELOPE_SIZES, LABEL_PRODUCTS};
use wordcraft_geom::Region;
use crate::WordApp;
use crate::dialogs::host::{Asks, WordForm, labelled, open_form};
use crate::dialogs::host::{Asks, WordForm, open_form};
// ---------------------------------------------------------------------------------------------
// Envelopes
@@ -72,12 +72,10 @@ impl WordForm for EnvelopeForm {
fn body(&mut self, ui: &mut egui::Ui, _cx: &mut FormCx<'_, '_>, _asks: &mut Vec<Asks>) -> bool {
let sizes: Vec<Entry<usize>> =
ENVELOPE_SIZES.iter().enumerate().map(|(i, (n, w, h))| Entry::new(i, envelope_label(n, *w, *h, &self.region))).collect();
labelled(ui, tl!("Delivery address:"), |name, ui| TextField::new(name, Bind::bound(&mut self.delivery)).lines(4).show(ui));
TextField::new(tl!("Delivery address:"), Bind::bound(&mut self.delivery)).lines(4).show(ui);
Checkbox::new(Bind::bound(&mut self.omit_return)).label(tl!("Omit")).show(ui);
labelled(ui, tl!("Return address:"), |name, ui| {
TextField::new(name, Bind::bound(&mut self.ret)).lines(3).enabled(!self.omit_return).show(ui)
});
labelled(ui, tl!("Envelope size:"), |name, ui| Select::new(name, Bind::bound(&mut self.size), &sizes).show(ui));
TextField::new(tl!("Return address:"), Bind::bound(&mut self.ret)).lines(3).enabled(!self.omit_return).show(ui);
Select::new(tl!("Envelope size:"), Bind::bound(&mut self.size), &sizes).show(ui);
self.ready()
}
fn commands(&self) -> Vec<(String, Value)> {
@@ -204,9 +202,9 @@ impl WordForm for LabelsForm {
Checkbox::new(Bind::bound(&mut self.recipients)).label(tl!("One label per recipient")).show(ui);
}
let per_recipient = self.has_recipients && self.recipients && !self.single;
labelled(ui, tl!("Address:"), |name, ui| TextField::new(name, Bind::bound(&mut self.text)).lines(4).enabled(!per_recipient).show(ui));
TextField::new(tl!("Address:"), Bind::bound(&mut self.text)).lines(4).enabled(!per_recipient).show(ui);
let products: Vec<Entry<usize>> = (0..LABEL_PRODUCTS.len()).map(|i| Entry::new(i, product_label(i, &self.region))).collect();
labelled(ui, tl!("Label:"), |name, ui| Select::new(name, Bind::bound(&mut self.product), &products).show(ui));
Select::new(tl!("Label:"), Bind::bound(&mut self.product), &products).show(ui);
let (rows, cols) = LABEL_PRODUCTS.get(self.product).map_or((1, 1), |p| (p.rows, p.cols));
let mut single = self.single;
let (mut row, mut col) = (self.row, self.col);
@@ -218,17 +216,21 @@ impl WordForm for LabelsForm {
Radio::new(1u8).label(tl!("Single label")).show(ui);
});
single = mode == 1;
if let Some(Some(v)) = labelled(ui, tl!("Row:"), |name, ui| {
NumberField::new(name, Bind::given(Some(row as f64))).range(1.0..=rows.max(1) as f64).enabled(single_on).show(ui)
})
.and_then(|out| out.value().copied())
if let Some(Some(v)) = NumberField::new(tl!("Row:"), Bind::given(Some(row as f64)))
.range(1.0..=rows.max(1) as f64)
.enabled(single_on)
.show(ui)
.value()
.copied()
{
row = v as usize;
}
if let Some(Some(v)) = labelled(ui, tl!("Column:"), |name, ui| {
NumberField::new(name, Bind::given(Some(col as f64))).range(1.0..=cols.max(1) as f64).enabled(single_on).show(ui)
})
.and_then(|out| out.value().copied())
if let Some(Some(v)) = NumberField::new(tl!("Column:"), Bind::given(Some(col as f64)))
.range(1.0..=cols.max(1) as f64)
.enabled(single_on)
.show(ui)
.value()
.copied()
{
col = v as usize;
}
@@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize};
use serde_json::{Value, json};
use super::{WordApp, count_field, named_field, number_or_zero, points};
use crate::dialogs::host::{Asks, WordForm, labelled};
use crate::dialogs::host::{Asks, WordForm};
/// The field's one name: a width that shares the text width out.
#[derive(Clone, Copy, Debug, PartialEq)]
@@ -96,7 +96,7 @@ impl WordForm for FormulaForm {
});
let functions: Vec<Entry<String>> = FORMULA_FUNCTIONS.iter().map(|n| Entry::new((*n).to_string(), (*n).to_string())).collect();
let mut picked = String::new();
labelled(ui, tl!("Paste function:").to_string(), |name, ui| Select::new(name, Bind::bound(&mut picked), &functions).show(ui));
Select::new(tl!("Paste function:").to_string(), Bind::bound(&mut picked), &functions).show(ui);
if !picked.is_empty() {
self.paste(&picked);
}
@@ -18,7 +18,7 @@ use serde_json::{Value, json};
use wordcraft_doc::section::LineNumberRestart;
use super::{WordApp, count_field, length_field, named_field, number_or_zero, points};
use crate::dialogs::host::{Asks, Filed, WordForm, captioned};
use crate::dialogs::host::{Asks, Filed, WordForm};
/// The field's one name: no limit on consecutive hyphens.
#[derive(Clone, Copy, Debug, PartialEq)]
@@ -105,14 +105,12 @@ impl WordForm for LineNumbersForm {
length_field(ui, tl!("From text:"), &mut self.distance, lengths, 0.0..=22.0 * 72.0, on && !self.auto_distance);
count_field(ui, tl!("Count by:"), &mut self.count_by, 1..=100, on);
let opts = [("restartPage", tl!("Restart Each Page")), ("restartSection", tl!("Restart Each Section")), ("continuous", tl!("Continuous"))];
captioned(ui, tl!("Numbering:").to_string(), |name, ui| {
RadioGroup::new(name, Bind::bound(&mut self.restart)).show(ui, |ui, _| {
Stack::new().show(ui, |ui, cx| {
for (at, (v, l)) in opts.iter().enumerate() {
cx.labelled(ui, at, Label::from(*l), SideLabel::new().layout(FieldLayout::After), Radio::new((*v).to_string()));
}
});
})
RadioGroup::new(tl!("Numbering:").to_string(), Bind::bound(&mut self.restart)).show(ui, |ui, _| {
Stack::new().show(ui, |ui, cx| {
for (at, (v, l)) in opts.iter().enumerate() {
cx.labelled(ui, at, Label::from(*l), SideLabel::new().layout(FieldLayout::After), Radio::new((*v).to_string()));
}
});
});
true
}
@@ -446,8 +444,6 @@ impl WordForm for LanguageForm {
let which: Vec<usize> = (0..list.len()).collect();
let source = keyed(which.as_slice(), |i: &usize| *i);
let selection = at.map_or_else(|| Selection::new(Vec::new(), None, None), Selection::single);
// A plain caption, not a `Field`: the list keeps its own accessible name (#7976).
Text::new(Label::from(heading.to_string())).show(ui);
let shown = List::<usize>::new(Label::from(heading.to_string()))
.select(SelectMode::Single)
.selection(Bind::given(selection))
+15 -11
View File
@@ -22,7 +22,7 @@ use serde_json::{Value, json};
use wordcraft_doc::section::NumFormat;
use wordcraft_engine::cmd::lists::{LEVELS, caret_list, level_json, levels_of};
use super::dialogs_para::{color_row, pick, radios, radios_in_section, srgba, word};
use super::dialogs_para::{color_row, pick, radios, srgba, word};
use super::host::{Asks, ChildAnswer, WordForm, open_form};
use crate::WordApp;
use crate::colors::{AutoFace, ColorFieldEmpty, Palette};
@@ -282,7 +282,7 @@ impl ListForm {
Stack::new().show(ui, |ui, _| {
Text::new(word(tl!("Preview"))).show(ui);
Picture::painter(word(tl!("Preview")), ThumbAspect::new(5, 3), preview(rows.clone(), level))
.extent(PictureSize::Sample(ThumbSize::Large))
.extent(PictureSize::Thumb(ThumbSize::Large))
.show(ui);
});
});
@@ -599,7 +599,7 @@ fn choose(ui: &mut Ui, salt: &'static str, label: Label, options: &[(&str, &str)
/// A radio group over `options` setting `value`.
fn choose_radio(ui: &mut Ui, label: Label, options: &[(&str, &str)], value: &mut String) {
let current = index_of(options, value).unwrap_or(0);
if let Some((v, _)) = radios_in_section(ui, label, &labels(options), current).and_then(|at| options.get(at)) {
if let Some((v, _)) = radios(ui, label, &labels(options), current).and_then(|at| options.get(at)) {
*value = v.to_string();
}
}
@@ -829,12 +829,6 @@ mod tests {
assert_eq!(h.state_mut().run("list.define", json!({})).unwrap(), json!({"pending": "defineList"}));
h.run_steps(2);
// The sheet fills the Preview image's rect, which is larger than the 80 × 48 icon-side thumbnail it once
// shrank to (#7977).
let preview = egui_kittest::kittest::Queryable::get_by_role_and_label(&h, egui::accesskit::Role::Image, "Preview").rect();
assert!(preview.width() > 80.0 && preview.height() > 48.0, "{theme}: the preview is {preview:?}");
let is_sheet = |r: egui::Rect| (r.width() - preview.width()).abs() <= 2.0 && (r.height() - preview.height()).abs() <= 2.0;
let mut shapes = Vec::new();
collect_shapes(&h.output().shapes, &mut shapes);
@@ -842,7 +836,11 @@ mod tests {
let white_rects: Vec<_> = shapes
.iter()
.filter_map(|s| match s {
egui::Shape::Rect(r) if r.fill == egui::Color32::WHITE && is_sheet(r.rect) => Some(r),
egui::Shape::Rect(r)
if r.fill == egui::Color32::WHITE && (r.rect.width() - 80.0).abs() <= 5.0 && (r.rect.height() - 48.0).abs() <= 5.0 =>
{
Some(r)
}
_ => None,
})
.collect();
@@ -852,7 +850,13 @@ mod tests {
let stroke_rects: Vec<_> = shapes
.iter()
.filter_map(|s| match s {
egui::Shape::Rect(r) if r.stroke.color == egui::Color32::from_gray(160) && is_sheet(r.rect) => Some(r),
egui::Shape::Rect(r)
if r.stroke.color == egui::Color32::from_gray(160)
&& (r.rect.width() - 80.0).abs() <= 5.0
&& (r.rect.height() - 48.0).abs() <= 5.0 =>
{
Some(r)
}
_ => None,
})
.collect();
+5 -32
View File
@@ -14,7 +14,6 @@ use craft::theme::Srgba;
use craft::ui::choice::{Checkbox, Radio, RadioGroup};
use craft::ui::contract::{Bind, CollectionEvent, Entry, FieldLayout, Props as _, Show as _, ShowCollection as _, ShowContainer as _, SideLabel};
use craft::ui::dialog::DialogId;
use craft::ui::display::Text;
use craft::ui::form::Field;
use craft::ui::layout_components::{Row, Stack};
use craft::ui::patterns::form_dialogs::FormCx;
@@ -26,7 +25,7 @@ use serde::{Deserialize, Serialize};
use serde_json::{Map, Value, json};
use wordcraft_doc::props::{Border, BorderStyle, Borders, Rgb, TabAlign, TabLeader, TabStop};
use super::host::{Asks, ChildAnswer, DialogHooks, Keyed, Settle, WordForm, captioned, open_form, open_with};
use super::host::{Asks, ChildAnswer, DialogHooks, Keyed, Settle, WordForm, open_form, open_with};
use crate::WordApp;
use crate::colors::{AutoFace, ColorFieldEmpty, Palette, color_field};
use crate::options::unit_kind;
@@ -61,23 +60,6 @@ pub(super) fn color_row(
}
}
/// `color_row` with `label` drawn beside it as plain text. Not a `Field`: its label scope would rename the split button
/// "Color:" and drop the colour it speaks ("Color: Automatic").
fn captioned_color_row(
ui: &mut Ui,
key: &'static str,
label: Label,
value: &mut String,
empty: &ColorFieldEmpty,
palette: &Palette,
asks: &mut Vec<Asks>,
) {
Row::new().show(ui, |ui, _| {
Text::new(label.clone()).show(ui);
color_row(ui, key, &label, value, empty, palette, asks);
});
}
/// A drop-down over `labels` under `label`, showing entry `current` (empty while it is `None`). The index of the entry
/// picked in this pass.
pub(super) fn pick(ui: &mut Ui, salt: &'static str, label: Label, labels: &[Label], current: Option<usize>, enabled: bool) -> Option<usize> {
@@ -90,18 +72,9 @@ pub(super) fn pick(ui: &mut Ui, salt: &'static str, label: Label, labels: &[Labe
.flatten()
}
/// A radio group over `labels` under a caption `label`, entry `current` chosen. The index chosen in this pass, when it
/// is another one.
/// A radio group over `labels` under `label`, entry `current` chosen. The index chosen in this pass, when it is
/// another one.
pub(super) fn radios(ui: &mut Ui, label: Label, labels: &[Label], current: usize) -> Option<usize> {
captioned(ui, label.clone(), |_, ui| radio_set(ui, label.clone(), labels, current)).flatten()
}
/// `radios` with no caption: for a group inside a section that already carries its title.
pub(super) fn radios_in_section(ui: &mut Ui, label: Label, labels: &[Label], current: usize) -> Option<usize> {
radio_set(ui, label, labels, current)
}
fn radio_set(ui: &mut Ui, label: Label, labels: &[Label], current: usize) -> Option<usize> {
let mut at = current;
RadioGroup::new(label, Bind::bound(&mut at)).show(ui, |ui, cx| {
for (i, text) in labels.iter().enumerate() {
@@ -508,7 +481,7 @@ fn lines(ui: &mut Ui, key: &'static str, l: &mut LineForm, area: SampleArea, fil
l.style = *style;
}
let automatic = ColorFieldEmpty::Automatic { label: word(tl!("Automatic")), value: "", face: AutoFace::One(srgba(Rgb(0, 0, 0))) };
captioned_color_row(ui, key, word(tl!("Color:")), &mut l.color, &automatic, palette, asks);
color_row(ui, key, &word(tl!("Color:")), &mut l.color, &automatic, palette, asks);
let names: Vec<Label> = WIDTHS.iter().map(|w| word(crate::i18n::fmt(tl!("{n} pt"), &[("n", &w.to_string())]))).collect();
let current = WIDTHS.iter().position(|w| *w == l.width);
if let Some(width) = pick(ui, "width", word(tl!("Width:")), &names, current, true).and_then(|at| WIDTHS.get(at)) {
@@ -567,7 +540,7 @@ impl WordForm for BordersForm {
Self::apply_to(ui, &mut self.whole_doc, word(tl!("This section")), word(tl!("Whole document")));
}
_ => {
captioned_color_row(ui, "fill", word(tl!("Fill")), &mut self.fill, &ColorFieldEmpty::NoColor, &palette, asks);
color_row(ui, "fill", &word(tl!("Fill")), &mut self.fill, &ColorFieldEmpty::NoColor, &palette, asks);
// The same sample as the Borders tab shows, without the lines and not editable.
let mut none = BorderEdges::default();
let area = if self.fill_to_text { SampleArea::Text } else { SampleArea::Paragraph };
@@ -1,7 +1,6 @@
use craft::behavior::{Mixed, Selection, keyed};
use craft::ui::contract::{Bind, Entry, SelectMode, Show as _, ShowCollection as _, ShowContainer as _};
use craft::ui::dialog::DialogId;
use craft::ui::display::Text;
use craft::ui::form::Field;
use craft::ui::list::{List, ListRow};
use craft::ui::patterns::form_dialogs::FormCx;
@@ -157,7 +156,6 @@ impl WordForm for CrossRefForm {
let source = keyed(&which, |i: &usize| *i);
let mut selection = self.selected.map_or_else(|| Selection::new(Vec::new(), None, None), Selection::single);
let targets = &self.targets;
Text::new(Label::from(tl!("For which item:").to_string())).show(ui);
let _ = List::new(Label::from(tl!("For which item:").to_string()))
.max_rows(8)
.select(SelectMode::Single)
@@ -20,7 +20,7 @@ use wordcraft_engine::cmd::references::FieldCode;
use super::sample::{LEADERS, leader_char, sample_card};
use crate::WordApp;
use crate::dialogs::host::{Asks, Filed, WordForm, captioned, labelled, open_form};
use crate::dialogs::host::{Asks, Filed, WordForm, open_form};
/// The tab leaders as drop-down entries (value, translated label).
pub(super) fn leaders() -> Vec<Entry<String>> {
@@ -104,21 +104,18 @@ impl WordForm for IndexForm {
fn body(&mut self, ui: &mut Ui, _cx: &mut FormCx<'_, '_>, asks: &mut Vec<Asks>) -> bool {
sample_card(tl!("Preview"), self.sample_lines(), self.right_align, leader_char(&self.leader)).show(ui);
let kind = captioned(ui, Label::from(tl!("Type:").to_string()), |name, ui| {
RadioGroup::new(name, Bind::given(self.kind.clone())).show(ui, |ui, _| {
Row::new().show(ui, |ui, _| {
Radio::new("indented".to_string()).label(Label::from(tl!("Indented").to_string())).show(ui);
Radio::new("runIn".to_string()).label(Label::from(tl!("Run-in").to_string())).show(ui);
});
})
let kind = RadioGroup::new(Label::from(tl!("Type:").to_string()), Bind::given(self.kind.clone())).show(ui, |ui, _| {
Row::new().show(ui, |ui, _| {
Radio::new("indented".to_string()).label(Label::from(tl!("Indented").to_string())).show(ui);
Radio::new("runIn".to_string()).label(Label::from(tl!("Run-in").to_string())).show(ui);
});
});
if let Some(kind) = kind.and_then(|kind| kind.output.value().cloned()) {
if let Some(kind) = kind.output.value().cloned() {
self.kind = kind;
}
let columns = labelled(ui, Label::from(tl!("Columns:").to_string()), |name, ui| {
NumberField::new(name, Bind::given(Some(f64::from(self.columns)))).range(1.0..=4.0).show(ui)
});
if let Some(Some(n)) = columns.and_then(|out| out.edit.value().cloned()) {
let columns =
NumberField::new(Label::from(tl!("Columns:").to_string()), Bind::given(Some(f64::from(self.columns)))).range(1.0..=4.0).show(ui);
if let Some(Some(n)) = columns.edit.value().cloned() {
self.columns = n.round().clamp(1.0, 4.0) as u32;
}
Checkbox::new(Bind::bound(&mut self.right_align)).label(Label::from(tl!("Page numbers at the right margin").to_string())).show(ui);
@@ -25,7 +25,6 @@ use craft::ui::list::{List, ListRow, ToggleCell, ToggleState};
use craft::ui::notices::Notice;
use craft::ui::runtime::env::Label;
use craft::ui::sections::{DialogRole, FooterButton};
use craft::ui::style::SurfaceKind;
use craft::ui::tabs::{Tab, TabKind, TabStrip};
use craft::ui::text::TextField;
use egui::{Context, Ui};
@@ -261,7 +260,6 @@ impl RibbonDialog {
let rows = &self.tree;
let out = List::new(word("Ribbon tabs"))
.id(self.tree_id(ui))
.surface(SurfaceKind::Frame)
.tree(true)
.select(SelectMode::Single)
.columns(columns)
@@ -405,7 +403,6 @@ fn pick(ui: &mut Ui, salt: &'static str, label: &str, rows: &[(String, String)],
let mut selection = at.map_or_else(Selection::default, Selection::single);
List::new(word(label))
.id(ui.scope_id().with(salt))
.surface(SurfaceKind::Frame)
.select(SelectMode::Single)
// The list scrolls its own rows, as main's fixed-height boxes did, so the dialog's body does not scroll it too.
.max_rows(12)
+41 -73
View File
@@ -3,21 +3,18 @@
//! `styles.copyFrom`, `styles.delete`, `styles.rename`), so agents get the same result without
//! the dialogs.
use craft::behavior::{ColumnWidth, EditEvent, Selection, SelectionChange, item_source::keyed};
use craft::behavior::{EditEvent, Selection, SelectionChange, item_source::keyed};
use craft::host::PickRequest;
use craft::ui::choice::Checkbox;
use craft::ui::contract::{Bind, CollectionEvent, Props as _, SelectMode, Show as _, ShowCollection as _, ShowContainer as _, request_rename};
use craft::ui::contract::{Bind, CollectionEvent, Props as _, SelectMode, Show as _, ShowCollection as _, ShowContainer as _};
use craft::ui::dialog::{Dialog, DialogId, DialogResult, DialogStack, StackDialog, dialog_id};
use craft::ui::display::Text;
use craft::ui::form::Field;
use craft::ui::layout::CellAlign;
use craft::ui::layout_components::{Grid, Stack};
use craft::ui::layout_components::Row;
use craft::ui::list::{List, ListRow};
use craft::ui::notices::Notice;
use craft::ui::patterns::form_dialogs::{FormCx, PathRow};
use craft::ui::runtime::env::{Env, Label};
use craft::ui::sections::{DialogRole, FooterButton};
use craft::ui::style::SurfaceKind;
use egui::{Context, Ui};
use serde::{Deserialize, Serialize};
use serde_json::{Value, json};
@@ -27,15 +24,6 @@ use super::styles::{action, label};
use crate::WordApp;
const ORGANIZER_KEY: &str = "organizer";
/// The Organizer's columns: each takes what it holds, and a list holds at least `LIST_WIDTH` (a fill column takes no more
/// than its content in a dialog that sizes to its content, so an empty list was a few pixels wide).
const COLUMNS: [ColumnWidth; 3] = [ColumnWidth::Content; 3];
/// The least width of a list, in points.
const LIST_WIDTH: f32 = 200.0;
/// The rows each list shows before it scrolls.
const LIST_ROWS: u16 = 12;
/// The other file's list has its name above it, so it shows one row fewer to end level with the first.
const OTHER_ROWS: u16 = LIST_ROWS - 1;
/// The Templates and Add-ins dialog's fields.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
@@ -248,69 +236,50 @@ impl OrganizerDialog {
fn body(&mut self, ui: &mut Ui) {
let reason = browse_reason(ui);
let mine_id = ui.scope_id().with("organizer_mine");
// Three columns as the old dialog had: this document's styles, Copy / Delete / Rename, the other file's styles.
Grid::new(&COLUMNS).cells(CellAlign::Top).show(ui, |ui, _| {
Stack::new().show(ui, |ui, _| {
ui.set_min_width(LIST_WIDTH);
let mut selection = Selection::single(self.left.clone());
let mine = &self.mine;
let source = keyed(mine, |st| text_of(st, "id"));
let out = List::new(label(tl!("Document")))
.surface(SurfaceKind::Frame)
.select(SelectMode::Single)
.selection(Bind::bound(&mut selection))
.rename(true)
.can_rename(|key: &String| {
mine.iter().find(|x| text_of(x, "id") == *key).is_some_and(|x| !x.get("builtIn").and_then(Value::as_bool).unwrap_or(true))
})
.id(mine_id)
.min_rows(LIST_ROWS)
.max_rows(LIST_ROWS)
.show_items(ui, &source, &mut |_, icx| {
let Some(st) = mine.get(icx.at) else { return ListRow::spacer() };
ListRow::new(label(text_of(st, "name"))).lead_text(label(glyph(&text_of(st, "type"))), label(""))
});
for event in out.events {
match event {
CollectionEvent::Selection { change: SelectionChange::Set(keys), .. } => {
if let Some(key) = keys.last() {
self.left = key.clone();
}
Row::new().show(ui, |ui, _| {
let mut selection = Selection::single(self.left.clone());
let mine = &self.mine;
let source = keyed(mine, |st| text_of(st, "id"));
let out = List::new(label(tl!("Document")))
.select(SelectMode::Single)
.selection(Bind::bound(&mut selection))
.rename(true)
.can_rename(|key: &String| {
mine.iter().find(|x| text_of(x, "id") == *key).is_some_and(|x| !x.get("builtIn").and_then(Value::as_bool).unwrap_or(true))
})
.id_salt("mine")
.show_items(ui, &source, &mut |_, icx| {
let Some(st) = mine.get(icx.at) else { return ListRow::spacer() };
ListRow::new(label(text_of(st, "name"))).lead_text(label(glyph(&text_of(st, "type"))), label(""))
});
for event in out.events {
match event {
CollectionEvent::Selection { change: SelectionChange::Set(keys), .. } => {
if let Some(key) = keys.last() {
self.left = key.clone();
}
CollectionEvent::Rename(EditEvent::Commit { after, .. }) => {
self.requests.push(Request::Rename { style: after.key, name: after.name });
}
_ => {}
}
CollectionEvent::Rename(EditEvent::Commit { after, .. }) => {
self.requests.push(Request::Rename { style: after.key, name: after.name });
}
_ => {}
}
});
Stack::new().show(ui, |ui, _| {
if action(ui, "copy", label(tl!("Copy")), !self.right.is_empty(), None) {
self.requests.push(Request::Copy);
}
if action(ui, "delete", label(tl!("Delete")), !self.left_builtin(), None) {
self.requests.push(Request::Delete(self.left.clone()));
}
// The list's own rename field takes the name in place.
if action(ui, "rename", label(tl!("Rename…")), !self.left_builtin(), None) {
request_rename(ui.ctx(), mine_id, &self.left);
}
});
Stack::new().show(ui, |ui, _| {
ui.set_min_width(LIST_WIDTH);
let name = std::path::Path::new(&self.file).file_name().map(|n| n.to_string_lossy().to_string()).unwrap_or_else(|| "—".into());
Text::new(label(name)).show(ui);
}
if action(ui, "copy", label(tl!("Copy")), !self.right.is_empty(), None) {
self.requests.push(Request::Copy);
}
if action(ui, "delete", label(tl!("Delete")), !self.left_builtin(), None) {
self.requests.push(Request::Delete(self.left.clone()));
}
let name = std::path::Path::new(&self.file).file_name().map(|n| n.to_string_lossy().to_string()).unwrap_or_else(|| "—".into());
Field::new(label(name)).show(ui, |ui, _| {
let mut selection = Selection::single(self.right.clone());
let other = &self.other;
let source = keyed(other, |(n, _)| n.clone());
let out = List::new(label(tl!("Template")))
.surface(SurfaceKind::Frame)
.select(SelectMode::Single)
.selection(Bind::bound(&mut selection))
.id_salt("other")
.min_rows(OTHER_ROWS)
.max_rows(OTHER_ROWS)
.show_items(ui, &source, &mut |_, icx| {
let Some((n, ty)) = other.get(icx.at) else { return ListRow::spacer() };
ListRow::new(label(n)).lead_text(label(glyph(ty)), label(""))
@@ -322,13 +291,12 @@ impl OrganizerDialog {
self.right = key.clone();
}
}
let picked = template_row(label(tl!("Template")), Bind::bound(&mut self.file), reason.clone()).show(ui).picked;
if let Some(path) = picked {
self.requests.push(Request::Load(path));
}
});
});
// The other file's path and Browse stand under both lists, at the dialog's full width.
let picked = template_row(label(tl!("Template")), Bind::bound(&mut self.file), reason.clone()).show(ui).picked;
if let Some(path) = picked {
self.requests.push(Request::Load(path));
}
if !self.message.is_empty() {
Notice::new(craft::theme::variant::Tone::Bad, label(&self.message)).show(ui);
}
+14 -17
View File
@@ -4,10 +4,10 @@
use craft::ui::choice::{Radio, RadioGroup};
use craft::ui::contract::{Bind, Props as _, Show as _, ShowContainer as _};
use craft::ui::dialog::DialogId;
use craft::ui::display::{Picture, PictureSize};
use craft::ui::display::Picture;
use craft::ui::form::{Field, FieldGroup};
use craft::ui::layout_components::{Row, Stack};
use craft::ui::list::{ThumbAspect, ThumbSize};
use craft::ui::list::ThumbAspect;
use craft::ui::patterns::form_dialogs::FormCx;
use craft::ui::primitives::{ContentPainterCx, HAlign, PaintShape, StrokeColor, StrokeWidth, TextRun};
use craft::ui::runtime::env::Label;
@@ -17,7 +17,7 @@ use egui::{CornerRadius, Rect, Ui, pos2, vec2};
use serde::{Deserialize, Serialize};
use serde_json::{Value, json};
use super::host::{Asks, WordForm, captioned, open_form};
use super::host::{Asks, WordForm, open_form};
use crate::WordApp;
const PREVIEW_W: f32 = 110.0;
@@ -81,27 +81,24 @@ impl EncloseForm {
d.text(line, &TextRun::new(text.as_str()).role(role).align(HAlign::Center));
});
})
.extent(PictureSize::Sample(ThumbSize::Large))
}
}
/// A radio group over `value` whose options are `(id, label)`.
fn radios(ui: &mut Ui, name: &'static str, value: &mut String, options: &[(&'static str, &'static str)], enabled: bool, horizontal: bool) {
let group = captioned(ui, Label::from(name), |name, ui| {
RadioGroup::new(name, Bind::given(value.clone())).enabled(enabled).show(ui, |ui, _| {
let items = |ui: &mut Ui| {
for (id, label) in options {
Radio::new((*id).to_string()).label(Label::from(tl!(*label))).enabled(enabled).show(ui);
}
};
if horizontal {
Row::new().show(ui, |ui, _| items(ui));
} else {
Stack::new().show(ui, |ui, _| items(ui));
let group = RadioGroup::new(Label::from(name), Bind::given(value.clone())).enabled(enabled).show(ui, |ui, _| {
let items = |ui: &mut Ui| {
for (id, label) in options {
Radio::new((*id).to_string()).label(Label::from(tl!(*label))).enabled(enabled).show(ui);
}
})
};
if horizontal {
Row::new().show(ui, |ui, _| items(ui));
} else {
Stack::new().show(ui, |ui, _| items(ui));
}
});
if let Some(v) = group.and_then(|g| g.output.value().cloned()) {
if let Some(v) = group.output.value().cloned() {
*value = v;
}
}
+28 -36
View File
@@ -19,7 +19,7 @@ use craft::ui::sections::Section;
use craft::ui::style::TypeRole;
use craft::ui::text::{NumberField, TextField};
use super::host::{Asks, WordForm, captioned, labelled, open_form};
use super::host::{Asks, WordForm, open_form};
/// Opens the form dialog `name` when it is one of this file's: Table Properties (only with a table selection) or Custom
/// Properties.
@@ -49,16 +49,14 @@ fn flag(ui: &mut Ui, id: &'static str, label: String, value: &mut bool, enabled:
/// A radio group choosing one of `options` (key, label) into `value`.
fn choose(ui: &mut Ui, id: &'static str, label: String, value: &mut String, options: &[(&str, String)]) {
let chosen = captioned(ui, Label::from(label), |name, ui| {
RadioGroup::new(name, Bind::given(value.clone())).id_salt(id).show(ui, |ui, _| {
Stack::new().show(ui, |ui, _| {
for (key, text) in options {
Radio::new((*key).to_string()).label(Label::from(text.clone())).show(ui);
}
});
})
let chosen = RadioGroup::new(Label::from(label), Bind::given(value.clone())).id_salt(id).show(ui, |ui, _| {
Stack::new().show(ui, |ui, _| {
for (key, text) in options {
Radio::new((*key).to_string()).label(Label::from(text.clone())).show(ui);
}
});
});
if let Some(next) = chosen.and_then(|c| c.output.value().cloned()) {
if let Some(next) = chosen.output.value().cloned() {
*value = next;
}
}
@@ -242,21 +240,14 @@ impl WordForm for CustomPropertiesForm {
let rows: Vec<String> = self.props.iter().map(|p| format!("{} = {}", p.name, p.value)).collect();
let positions: Vec<usize> = (0..rows.len()).collect();
let mut selection = if self.selected < rows.len() { Selection::single(self.selected) } else { Selection::default() };
if rows.is_empty() {
// lean: craft's `List` measures its `.empty()` text shorter than it draws it, so the dialog is a row short and
// its footer is drawn over the last row (#7982). Show the text ourselves; drop this once craft-libs fixes
// `List`. The same latent overlap may hit the other `.empty()` users: bookmarks.rs:112/268, macros.rs:71,
// dialogs_refs/cross_ref.rs:165, dialogs_refs/sources.rs:311 and dialogs_review.rs:423.
Text::new(Label::from(tl!("This document has no custom properties.").to_string())).shade(Shade::Muted).show(ui);
} else {
List::new(Label::from(tl!("Properties").to_string()))
.id_salt("props")
.max_rows(6)
.select(SelectMode::Single)
.allow_empty(true)
.selection(Bind::bound(&mut selection))
.show_items(ui, &keyed(&positions, |at| *at), &mut |at, _| ListRow::new(rows.get(*at).cloned().unwrap_or_default()));
}
List::new(Label::from(tl!("Properties").to_string()))
.id_salt("props")
.max_rows(6)
.select(SelectMode::Single)
.allow_empty(true)
.empty(Label::from(tl!("This document has no custom properties.").to_string()))
.selection(Bind::bound(&mut selection))
.show_items(ui, &keyed(&positions, |at| *at), &mut |at, _| ListRow::new(rows.get(*at).cloned().unwrap_or_default()));
if let Some(at) = selection.items.first().copied()
&& at != self.selected
{
@@ -274,16 +265,15 @@ impl WordForm for CustomPropertiesForm {
self.delete();
}
});
let typed = labelled(ui, Label::from(tl!("Name:").to_string()), |name, ui| {
TextField::new(name, Bind::given(self.name.clone())).id_salt("name").limit(wordcraft_engine::cmd::file::MAX_CUSTOM_NAME).show(ui)
});
if let Some(text) = typed.and_then(|out| out.value().cloned()) {
let typed = TextField::new(Label::from(tl!("Name:").to_string()), Bind::given(self.name.clone()))
.id_salt("name")
.limit(wordcraft_engine::cmd::file::MAX_CUSTOM_NAME)
.show(ui);
if let Some(text) = typed.value().cloned() {
self.name = text;
}
let typed = labelled(ui, Label::from(tl!("Value:").to_string()), |name, ui| {
TextField::new(name, Bind::given(self.value.clone())).id_salt("value").show(ui)
});
if let Some(text) = typed.and_then(|out| out.value().cloned()) {
let typed = TextField::new(Label::from(tl!("Value:").to_string()), Bind::given(self.value.clone())).id_salt("value").show(ui);
if let Some(text) = typed.value().cloned() {
self.value = text;
}
if !self.message.is_empty() {
@@ -454,9 +444,11 @@ fn mixed_check(ui: &mut Ui, id: &'static str, label: String, key: &str, value: &
/// A length field over points, shown in the interface unit of `units`, within `lo..=hi` points.
fn length(ui: &mut Ui, id: &'static str, label: String, value: &mut f32, (lo, hi): (f32, f32), units: LengthUnits, enabled: bool) {
let mut points = Some(f64::from(*value));
labelled(ui, Label::from(label), |name, ui| {
NumberField::length(name, Bind::bound(&mut points), units).id_salt(id).range(f64::from(lo)..=f64::from(hi)).enabled(enabled).show(ui)
});
NumberField::length(Label::from(label), Bind::bound(&mut points), units)
.id_salt(id)
.range(f64::from(lo)..=f64::from(hi))
.enabled(enabled)
.show(ui);
if let Some(next) = points {
*value = next as f32;
}
+1 -19
View File
@@ -7,9 +7,8 @@
//! answer is inferred from side effects.
use craft::color_ui::ui::{ColorPickerDialog, ColorPickerTab};
use craft::ui::contract::{Bind, FieldLayout, ShowContainer as _};
use craft::ui::contract::Bind;
use craft::ui::dialog::{ChildDialog, DialogId, DialogResult, DialogStack, HeldAnswer, HeldOk, StackDialog, dialog_id};
use craft::ui::form::Field;
use craft::ui::patterns::form_dialogs::{AboutTab, FormButtons, FormCx, FormDialog, HostedAbout};
use craft::ui::runtime::env::Label;
use craft::ui::sections::FooterButton;
@@ -418,23 +417,6 @@ impl<F: WordForm> StackDialog for FormHost<F> {
}
}
/// `show` (given `label` to name its control, and the field's `Ui`) with `label` drawn beside the control. A text box,
/// number box or drop-down names itself but draws no caption, so every bare one in a dialog goes through here
/// (#7976). `None` when the field is not shown this pass.
pub(crate) fn labelled<R>(ui: &mut Ui, label: impl Into<Label>, show: impl FnMut(Label, &mut Ui) -> R) -> Option<R> {
field(ui, FieldLayout::Beside, label.into(), show)
}
/// `labelled`, with the caption above the control: for a radio group or a preview, which has no box for a side label
/// to sit against (#7976).
pub(crate) fn captioned<R>(ui: &mut Ui, label: impl Into<Label>, show: impl FnMut(Label, &mut Ui) -> R) -> Option<R> {
field(ui, FieldLayout::Above, label.into(), show)
}
fn field<R>(ui: &mut Ui, layout: FieldLayout, label: Label, mut show: impl FnMut(Label, &mut Ui) -> R) -> Option<R> {
Field::new(label.clone()).layout(layout).show(ui, |ui, _| show(label.clone(), ui)).inner
}
/// Opens `form` as a dialog, over `parent` when there is one.
pub(crate) fn open_form<F: WordForm>(app: &mut WordApp, parent: Option<DialogId>, form: F) -> DialogId {
let id = open_node(app, parent, FormHost::new(form, parent));
+5 -10
View File
@@ -22,7 +22,7 @@ use serde::Serialize;
use serde_json::{Value, json};
use wordcraft_engine::cmd::mailings::{FilterOp, FilterRule, SortKey};
use super::host::{DialogHooks, Settle, labelled, open_with};
use super::host::{DialogHooks, Settle, open_with};
use crate::WordApp;
/// The address parts Match Fields lists, with their keys in `mailings.matchFields`' `address`.
@@ -376,7 +376,7 @@ fn recipient_body(ui: &mut egui::Ui, d: &mut RecipientDraft, editing: &mut bool,
filter.only_merged = false;
}
Checkbox::new(Bind::bound(&mut filter.only_merged)).label(tl!("Show only records that will be merged")).enabled(order.is_some()).show(ui);
labelled(ui, tl!("Find in list:"), |name, ui| TextField::search(name, Bind::bound(&mut filter.find)).show(ui));
TextField::search(tl!("Find in list"), Bind::bound(&mut filter.find)).show(ui);
// The rows the grid shows, by real index: edits and removes go to the right record.
let fresh = visible_recipients(rows, order.as_deref(), &filter.find, filter.only_merged);
// A press that ends a cell's edit (one on the row's Remove part) completes its click on release, a pass later: the
@@ -394,7 +394,7 @@ fn recipient_body(ui: &mut egui::Ui, d: &mut RecipientDraft, editing: &mut bool,
let columns = fields
.iter()
.enumerate()
.map(|(j, f)| ColumnSpec::new(ColumnKey::index(j as u32), f.clone(), ColumnWidth::Controls(6.0)).removable(tl!("Remove field"), can_remove))
.map(|(j, f)| ColumnSpec::new(ColumnKey::index(j as u32), f.clone(), ColumnWidth::fill(1.0)).removable(tl!("Remove field"), can_remove))
.collect();
// The dialog body scrolls, and a collection owns its own scroll: the grid shows this many records and scrolls
// the rest itself.
@@ -530,16 +530,11 @@ fn filter_section(ui: &mut egui::Ui, fields: &[String], filter: &mut RecipientFi
let directions = [Entry::new(false, tl!("Ascending")), Entry::new(true, tl!("Descending"))];
for (i, (field, desc)) in filter.sort.iter_mut().enumerate() {
let label = tl!(if i == 0 { "Sort by" } else { "Then by" });
if let Some(f) = labelled(ui, label, |name, ui| Select::new(name, Bind::given(field.clone()), &keys).id_salt(("sort", i)).show(ui))
.and_then(|out| out.value().cloned())
{
if let Some(f) = Select::new(label, Bind::given(field.clone()), &keys).id_salt(("sort", i)).show(ui).value().cloned() {
*field = f;
}
let has_field = !field.is_empty();
if let Some(d) =
labelled(ui, tl!("Order"), |name, ui| Select::new(name, Bind::given(*desc), &directions).id_salt(("dir", i)).enabled(has_field).show(ui))
.and_then(|out| out.value().copied())
{
if let Some(d) = Select::new(tl!("Order"), Bind::given(*desc), &directions).id_salt(("dir", i)).enabled(has_field).show(ui).value().copied() {
*desc = d;
}
}
+12 -16
View File
@@ -15,7 +15,7 @@ use craft::ui::text::{NumberField, TextField};
use serde::{Deserialize, Serialize};
use serde_json::{Value, json};
use super::host::{Asks, DialogHooks, FormHost, Settle, WordForm, captioned, labelled, open_form, open_form_with, open_with};
use super::host::{Asks, DialogHooks, FormHost, Settle, WordForm, open_form, open_form_with, open_with};
use super::mailings::ADDRESS_PARTS;
use crate::WordApp;
@@ -115,7 +115,7 @@ impl WordForm for InsertMergeFieldForm {
} else if let (Some(name), _) = pick_name(ui, tl!("Fields:"), &self.fields, &self.field) {
self.field = name;
}
labelled(ui, tl!("Field:"), |name, ui| TextField::new(name, Bind::bound(&mut self.field)).show(ui));
TextField::new(tl!("Field:"), Bind::bound(&mut self.field)).show(ui);
!self.field.trim().is_empty()
}
fn commands(&self) -> Vec<(String, Value)> {
@@ -209,7 +209,7 @@ impl WordForm for FindRecipientForm {
Some(tl!("Find").into())
}
fn body(&mut self, ui: &mut egui::Ui, _cx: &mut FormCx<'_, '_>, _asks: &mut Vec<Asks>) -> bool {
labelled(ui, tl!("Find:"), |name, ui| TextField::new(name, Bind::bound(&mut self.text)).show(ui));
TextField::new(tl!("Find:"), Bind::bound(&mut self.text)).show(ui);
!self.text.trim().is_empty()
}
fn commands(&self) -> Vec<(String, Value)> {
@@ -261,12 +261,10 @@ impl WordForm for MergeRecordsForm {
}
fn body(&mut self, ui: &mut egui::Ui, _cx: &mut FormCx<'_, '_>, _asks: &mut Vec<Asks>) -> bool {
let mut choice = self.choice;
captioned(ui, tl!("Records"), |name, ui| {
RadioGroup::new(name, Bind::bound(&mut choice)).show(ui, |ui, _| {
Radio::new(0u8).label(tl!("All")).show(ui);
Radio::new(1u8).label(tl!("Current record")).show(ui);
Radio::new(2u8).label(tl!("From:")).show(ui);
})
RadioGroup::new(tl!("Records"), Bind::bound(&mut choice)).show(ui, |ui, _| {
Radio::new(0u8).label(tl!("All")).show(ui);
Radio::new(1u8).label(tl!("Current record")).show(ui);
Radio::new(2u8).label(tl!("From:")).show(ui);
});
self.choice = choice;
// Typing a number picks the range.
@@ -346,19 +344,17 @@ impl WordForm for MergeRuleForm {
}))
.show(ui);
if self.fields.is_empty() {
labelled(ui, tl!("Field:"), |name, ui| TextField::new(name, Bind::bound(&mut self.field)).show(ui));
TextField::new(tl!("Field:"), Bind::bound(&mut self.field)).show(ui);
} else {
let entries: Vec<Entry<String>> = self.fields.iter().map(|f| Entry::new(f.clone(), Label::from(f.clone()))).collect();
if let Some(f) = labelled(ui, tl!("Field:"), |name, ui| Select::new(name, Bind::given(self.field.clone()), &entries).show(ui))
.and_then(|out| out.value().cloned())
{
if let Some(f) = Select::new(tl!("Field:"), Bind::given(self.field.clone()), &entries).show(ui).value().cloned() {
self.field = f;
}
}
labelled(ui, tl!("Equals:"), |name, ui| TextField::new(name, Bind::bound(&mut self.value)).show(ui));
TextField::new(tl!("Equals:"), Bind::bound(&mut self.value)).show(ui);
if !skip {
labelled(ui, tl!("Then insert:"), |name, ui| TextField::new(name, Bind::bound(&mut self.then)).show(ui));
labelled(ui, tl!("Otherwise insert:"), |name, ui| TextField::new(name, Bind::bound(&mut self.els)).show(ui));
TextField::new(tl!("Then insert:"), Bind::bound(&mut self.then)).show(ui);
TextField::new(tl!("Otherwise insert:"), Bind::bound(&mut self.els)).show(ui);
}
self.params().is_some()
}
+8 -10
View File
@@ -8,7 +8,7 @@ use craft::ui::patterns::form_dialogs::FormCx;
use craft::ui::runtime::env::Label;
use serde::{Deserialize, Serialize};
use super::host::{Asks, WordForm, captioned, open_form};
use super::host::{Asks, WordForm, open_form};
use super::{Value, WordApp};
use egui::Ui;
use serde_json::json;
@@ -69,15 +69,13 @@ impl WordForm for PasteSpecialForm {
return true;
}
let formats = self.formats.clone();
captioned(ui, Label::from(tl!("Paste as:")), |name, ui| {
RadioGroup::new(name, Bind::bound(&mut self.choice)).show(ui, |ui, _| {
Stack::new().show(ui, |ui, cx| {
for (at, f) in formats.iter().enumerate() {
let label = wordcraft_engine::cmd::paste::FORMATS.iter().find(|(id, _)| id == f).map(|(_, l)| *l).unwrap_or(f.as_str());
cx.labelled(ui, at, Label::from(tl!(label).to_owned()), SideLabel::new().layout(FieldLayout::After), Radio::new(at));
}
});
})
RadioGroup::new(Label::from(tl!("Paste as:")), Bind::bound(&mut self.choice)).show(ui, |ui, _| {
Stack::new().show(ui, |ui, cx| {
for (at, f) in formats.iter().enumerate() {
let label = wordcraft_engine::cmd::paste::FORMATS.iter().find(|(id, _)| id == f).map(|(_, l)| *l).unwrap_or(f.as_str());
cx.labelled(ui, at, Label::from(tl!(label).to_owned()), SideLabel::new().layout(FieldLayout::After), Radio::new(at));
}
});
});
if let Some(f) = formats.get(self.choice) {
Text::new(Label::from(tl!("Result"))).show(ui);
+2 -2
View File
@@ -191,11 +191,11 @@ const MARGIN_SIDES: [(&str, &str); 4] = [("top", "Top"), ("left", "Left"), ("bot
fn open_cell_margins(app: &mut WordApp, ctx: &Context, parent: Option<DialogId>) -> Option<DialogId> {
let margins = cell_margins_pt(app)?;
let fields = DialogFields::from_pairs(MARGIN_SIDES.iter().zip(margins).map(|((key, _), v)| (*key, v)));
let units = crate::options::lengths(app.session.units());
let kind = crate::options::unit_kind(app.session.units());
let dialog = HostedParamDialog::new(ctx, "tableCellMargins", fields, move |fields| {
let params: Vec<Param> = MARGIN_SIDES
.iter()
.map(|(key, label)| Param::number(*key, tl!(label).to_string(), 0.0, units.shown.step(), 2).bounds(Some(0.0), Some(144.0)).length(units))
.map(|(key, label)| Param::number(*key, tl!(label).to_string(), 0.0, 1.0, 2).bounds(Some(0.0), Some(144.0)).unit(kind))
.collect();
ParamDialog::command("tableCellMargins", tl!("Cell Margins").to_string(), params).values(Bind::bound(fields)).alt_resets(false)
});
+2 -2
View File
@@ -8,7 +8,7 @@ use craft::ui::contract::{
Bind, CollectionEvent, ColumnSpec, Entry, Props as _, SelectMode, Show as _, ShowCollection as _, ShowContainer as _, TooltipSpec, clicked,
};
use craft::ui::dialog::{Dialog, DialogId, DialogResult, DialogStack, StackDialog, dialog_id};
use craft::ui::display::{Picture, PictureSize, Shade, Text};
use craft::ui::display::{Picture, Shade, Text};
use craft::ui::form::Field;
use craft::ui::list::{List, ListRow};
use craft::ui::pickers::Select;
@@ -183,7 +183,7 @@ impl ManageStylesDialog {
if let Some((key, image)) = &self.preview {
let image = image.clone();
let make = move || image.clone();
Picture::new(label(tl!("Preview")), self.made, &make).revision(key.styles).extent(PictureSize::DevicePixels).show(ui);
Picture::new(label(tl!("Preview")), self.made, &make).revision(key.styles).show(ui);
}
Text::new(label(describe(&cur))).shade(Shade::Muted).show(ui);
let style = self.selected.clone();
-209
View File
@@ -2283,212 +2283,3 @@ fn modal_dialog_with_open_popup_does_not_shake_on_inside_click_but_shakes_on_out
let key2 = chrome::nudge_id(&h.ctx, id2);
assert!(h.ctx.data(|d| d.get_temp::<f64>(key2)).is_none(), "reopened dialog starts still");
}
/// #7976: a text box, number box, drop-down or radio group has an accessible name but draws no caption of its own;
/// the dialog must draw one beside or above it, or the field reads as a bare box.
#[test]
fn bare_fields_and_groups_draw_their_captions() {
use egui::accesskit::Role;
for (dialog, captions) in
[("envelopes", &["Delivery address", "Return address", "Envelope size"][..]), ("dropCap", &["Position", "Lines to drop"][..])]
{
let mut h = app_harness(app_with("Lanterns"));
h.state_mut().run("ui.dialog", json!({"name": dialog})).unwrap();
h.run_steps(6);
for caption in captions {
let drawn = h.query_all(egui_kittest::kittest::By::new().role(Role::Label).label_contains(caption)).count();
assert!(drawn > 0, "{dialog} draws no caption \"{caption}\"");
}
}
}
/// #7976: a caption is drawn once. A group inside a titled section, or a box after a radio that says the same
/// words, must not repeat them as a second caption.
#[test]
fn captions_are_not_drawn_twice() {
use egui::accesskit::Role;
for (dialog, caption) in
[("trackChangesOptions", "Balloons"), ("trackChangesOptions", "Comments"), ("pageNumbers", "Start at"), ("tableSort", "My list has")]
{
let mut app = app_with("Lanterns");
if dialog == "tableSort" {
app.run("insert.table", json!({"rows": 3, "cols": 3})).unwrap();
}
let mut h = app_harness(app);
h.state_mut().run("ui.dialog", json!({"name": dialog})).unwrap();
h.run_steps(6);
let drawn = h.query_all(egui_kittest::kittest::By::new().role(Role::Label).label_contains(caption)).count();
assert!(drawn <= 1, "{dialog} draws \"{caption}\" {drawn} times");
}
}
/// #7977: a preview picture is drawn at a sample size, not at the icon side it takes by default.
#[test]
fn dialog_previews_are_drawn_larger_than_a_control() {
use egui::accesskit::Role;
for dialog in ["enclose", "defineBullet"] {
let mut h = app_harness(app_with("Lanterns"));
h.state_mut().run("ui.dialog", json!({"name": dialog})).unwrap();
h.run_steps(6);
let preview = h.get_by_role_and_label(Role::Image, "Preview").rect();
let button = h.get_by_role_and_label(Role::Button, "Cancel").rect();
assert!(
preview.height() > 2.0 * button.height(),
"{dialog}: the preview is {}pt high beside a {}pt button",
preview.height(),
button.height()
);
}
}
/// #7982: Custom Properties' hint wraps inside the dialog instead of running under the Cancel button.
#[test]
fn custom_properties_hint_does_not_run_under_the_buttons() {
use egui::accesskit::Role;
let mut h = app_harness(app_with("Lanterns"));
h.state_mut().run("ui.dialog", json!({"name": "customProperties"})).unwrap();
h.run_steps(6);
let hint = h.get_by_label_contains("Text properties only").rect();
let cancel = h.get_by_role_and_label(Role::Button, "Cancel").rect();
let value = h.get_by_role_and_label(Role::TextInput, "Value:").rect();
assert!(!hint.intersects(cancel) && !value.intersects(cancel), "the hint {hint:?} or Value {value:?} overlaps Cancel {cancel:?}");
}
/// #7970: Cell Margins shows the table's points in the interface unit (0.19 cm, not 5.4 cm), and OK without
/// an edit leaves the table's margins as they were.
#[test]
fn cell_margins_dialog_shows_points_in_the_interface_unit_and_ok_changes_nothing() {
let mut app = app_with("");
let _ = app.run("insert.table", json!({"rows": 1, "cols": 1}));
app.session.prefs.units = Some(wordcraft_geom::Unit::Centimeters);
let mut h = app_harness(app);
h.run_steps(2);
let (tp, _, _) = h.state().session.sel.focus.path.cell().unwrap();
let margins =
|h: &egui_kittest::Harness<'_, WordApp>| h.state().session.doc.table(h.state().session.sel.focus.story, &tp).unwrap().props.cell_margins;
let before = margins(&h);
let _ = h.state_mut().run("ui.dialog", json!({"name": "tableCellMargins"}));
h.run_steps(3);
let left = h.get_by_role_and_label(egui::accesskit::Role::SpinButton, "Left").value().unwrap_or_default();
let shown: f64 = left.trim_end_matches(|c: char| !c.is_ascii_digit()).replace(',', ".").parse().unwrap_or(f64::NAN);
assert!(shown < 1.0, "5.4 pt is about 0.19 cm, not the point count: {left:?}");
let id = id_of(h.state(), "tableCellMargins");
let ctx = h.ctx.clone();
let _ = h.state_mut().dialog_host.confirm_by_id(&ctx, id);
h.run_steps(4);
assert_eq!(margins(&h), before, "OK without an edit writes no margins");
}
/// #7970: a width typed into Cell Margins in the interface unit reaches the table in points (1 cm is about 28 pt).
#[test]
fn cell_margins_dialog_converts_a_typed_length_back_to_points() {
let mut app = app_with("");
let _ = app.run("insert.table", json!({"rows": 1, "cols": 1}));
app.session.prefs.units = Some(wordcraft_geom::Unit::Centimeters);
let mut h = app_harness(app);
h.run_steps(2);
let (tp, _, _) = h.state().session.sel.focus.path.cell().unwrap();
let _ = h.state_mut().run("ui.dialog", json!({"name": "tableCellMargins"}));
h.run_steps(3);
h.get_by_role_and_label(egui::accesskit::Role::SpinButton, "Left").click();
h.run_steps(3);
h.key_press_modifiers(egui::Modifiers::COMMAND, egui::Key::A);
h.event(egui::Event::Paste("1".into()));
h.run_steps(3);
h.key_press(egui::Key::Tab);
h.run_steps(3);
let id = id_of(h.state(), "tableCellMargins");
let ctx = h.ctx.clone();
let _ = h.state_mut().dialog_host.confirm_by_id(&ctx, id);
h.run_steps(4);
let left = h.state().session.doc.table(h.state().session.sel.focus.story, &tp).unwrap().props.cell_margins.map(|m| m[1]);
assert!(left.is_some_and(|l| (l - 28.35).abs() < 0.5), "1 cm is about 28.35 pt: {left:?}");
}
/// #7980: the Organizer shows this document's styles and the other file's side by side, with Copy, Delete and
/// Rename between them, all inside the dialog.
#[test]
fn organizer_shows_both_lists_and_its_buttons() {
use egui::accesskit::Role;
let mut h = app_harness(app_with(""));
h.run_steps(2);
let _ = h.state_mut().run("ui.dialog", json!({"name": "organizer"}));
h.run_steps(4);
let rect = |h: &egui_kittest::Harness<'_, WordApp>, role, name: &str| h.get_by_role_and_label(role, name).rect();
let mine = rect(&h, Role::List, "Document");
let other = rect(&h, Role::List, "Template");
assert!(mine.is_positive() && other.is_positive() && mine.right() <= other.left(), "the lists stand side by side: {mine:?} {other:?}");
// Each list is wider than the button column between them, empty (no other file) or not.
let rename = rect(&h, Role::Button, "Rename…");
assert!(mine.width() > rename.width() && other.width() > rename.width(), "the lists are wider than the buttons: {mine:?} {other:?} {rename:?}");
// The ribbon has its own Copy: the one that counts stands between the lists.
for name in ["Copy", "Delete", "Rename…"] {
let between = h
.query_all(egui_kittest::kittest::By::new().role(Role::Button).label(name))
.any(|b| b.rect().left() >= mine.right() - 1.0 && b.rect().right() <= other.left() + 1.0);
assert!(between, "{name} stands between the lists {mine:?} {other:?}");
}
}
/// Part of #7980: the Organizer's two lists have a visible frame, as before the port; without it an empty list is a
/// blank patch.
#[test]
fn the_organizer_lists_are_framed() {
use egui::accesskit::Role;
fn rects<'a>(shape: &'a egui::Shape, out: &mut Vec<&'a egui::epaint::RectShape>) {
match shape {
egui::Shape::Vec(inner) => inner.iter().for_each(|s| rects(s, out)),
egui::Shape::Rect(r) => out.push(r),
_ => {}
}
}
let mut h = app_harness(app_with(""));
h.run_steps(2);
let _ = h.state_mut().run("ui.dialog", json!({"name": "organizer"}));
h.run_steps(4);
let mut seen = Vec::new();
h.output().shapes.iter().for_each(|c| rects(&c.shape, &mut seen));
for label in ["Document", "Template"] {
let list = h.get_by_role_and_label(Role::List, label).rect();
assert!(
seen.iter().any(|r| r.stroke.width > 0.0
&& r.stroke.color.a() > 0
&& r.rect.contains_rect(list.shrink(2.0))
&& list.expand(2.0).contains_rect(r.rect)),
"the list {label:?} {list:?} has a border"
);
}
}
/// Part of #7981 and #7980: the lists of Customize Ribbon and its Quick Access Toolbar page have a visible
/// frame, as before the port; without it an empty list is a blank patch.
#[test]
fn the_ribbon_customizer_lists_are_framed() {
use egui::accesskit::Role;
fn rects<'a>(shape: &'a egui::Shape, out: &mut Vec<&'a egui::epaint::RectShape>) {
match shape {
egui::Shape::Vec(inner) => inner.iter().for_each(|s| rects(s, out)),
egui::Shape::Rect(r) => out.push(r),
_ => {}
}
}
fn assert_framed(h: &egui_kittest::Harness<'_, WordApp>, label: &str) {
let list = h.get_by_role_and_label(Role::List, label).rect();
let mut seen = Vec::new();
h.output().shapes.iter().for_each(|c| rects(&c.shape, &mut seen));
assert!(
seen.iter().any(|r| r.stroke.width > 0.0
&& r.stroke.color.a() > 0
&& r.rect.contains_rect(list.shrink(2.0))
&& list.expand(2.0).contains_rect(r.rect)),
"the list {label:?} {list:?} has a border"
);
}
let mut h = app_harness(app_with(""));
open_named(&mut h, "customizeRibbon", json!({}));
assert_framed(&h, "Categories:");
assert_framed(&h, "Commands:");
assert_framed(&h, "Ribbon tabs");
h.get_by_role_and_label(Role::Tab, "Quick Access Toolbar").click();
h.run_steps(3);
assert_framed(&h, "Quick Access Toolbar");
}
+1 -17
View File
@@ -44,8 +44,7 @@ pub(crate) fn button_picture(id: &str) -> &'static str {
/// The ink math pictures are rendered in: the theme's text colour.
fn ink(ui: &Ui) -> Color32 {
// The craft theme's token, not egui's visuals, which the craft theme does not drive (grey ink in the light theme, #7975).
craft::ui::style::rgba_color(craft::ui::runtime::env::Env::of(ui).tokens.color.text.normal)
ui.visuals().text_color()
}
/// The keys `0..n` as a collection source.
@@ -387,21 +386,6 @@ mod placeholder_tests {
output.textures_delta.clear();
}
/// The pictures' ink is the craft theme's text colour, so it reads against the window in the light theme (egui's
/// own visuals are not driven by the craft theme and gave grey ink there, #7975).
#[test]
fn the_equation_ink_contrasts_with_the_theme_surface() {
let ctx = crate::test_harness::context();
let mut output = ctx.run_ui(egui::RawInput::default(), |ui| {
let env = craft::ui::runtime::env::Env::of(ui);
let luma = |c: egui::Color32| 0.299 * f32::from(c.r()) + 0.587 * f32::from(c.g()) + 0.114 * f32::from(c.b());
let ink = super::ink(ui);
let surface = craft::ui::style::rgba_color(env.tokens.color.surface.background);
assert!((luma(ink) - luma(surface)).abs() > 100.0, "ink {ink:?} against {surface:?}");
});
output.textures_delta.clear();
}
#[test]
fn a_missing_math_glyph_falls_back_to_its_linear_name() {
// Without craft-fonts the interface fonts may have no `┬`: the Equation button's picture
+26 -76
View File
@@ -9,7 +9,6 @@ use craft::behavior::{EditEvent, MotionMode, keyed};
use craft::ui::buttons::Button;
use craft::ui::contract::{Bind, Entry, Props as _, Show, ShowCollection, ShowContainer};
use craft::ui::display::{Elide, Shade, Text};
use craft::ui::form::{SliderField, SliderFieldLayout};
use craft::ui::layout_components::Row;
use craft::ui::list::{List, ListRow};
use craft::ui::patterns::preferences::{GroupSpec, PageSpec, PrefValue, PreferencesModel, PreferencesPage, RowKind, RowSpec};
@@ -303,6 +302,7 @@ impl PreferencesModel for OptionsModel<'_> {
use crate::StatusCount;
use crate::scroll::ScrollSpeed;
use crate::theme::{Animations, Appearance};
use wordcraft_engine::speech::{MAX_RATE, MIN_RATE};
let app = &*self.app;
let s = &self.strings;
let prefs = &app.session.prefs;
@@ -375,8 +375,7 @@ impl PreferencesModel for OptionsModel<'_> {
b("display.spaces", tl!("Spaces"), marks.spaces),
b("display.paragraphs", tl!("Paragraph marks"), marks.paragraphs),
b("display.hidden", tl!("Hidden text"), marks.hidden),
b("display.allMarks", tl!("Show all formatting marks"), app.session.view.marks)
.help(tl!("These marks show even when Show/Hide ¶ is off.")),
b("display.allMarks", tl!("Show all formatting marks"), app.session.view.marks),
],
),
GroupSpec::new(
@@ -405,7 +404,8 @@ impl PreferencesModel for OptionsModel<'_> {
],
),
],
);
)
.footnote(tl!("These marks show even when Show/Hide ¶ is off."));
let proofing = page_of(
"proofing",
@@ -445,11 +445,7 @@ impl PreferencesModel for OptionsModel<'_> {
GroupSpec::new(Some(tl!("Save documents")), {
// The browser can't write to the user's files, so AutoSave can't be turned on there (#176).
let row = b("save.autosave", tl!("AutoSave documents you have saved in WordCraft"), app.autosave && !browser).enabled(!browser);
vec![row.help(if browser {
&s.autosave_reason
} else {
tl!("AutoSave writes your changes to the file a moment after you stop typing.")
})]
vec![if browser { row.help(&s.autosave_reason) } else { row }]
}),
// The open document's `file.privacyOptions` (#1062): saved with it, honoured when it is saved.
GroupSpec::new(
@@ -464,12 +460,12 @@ impl PreferencesModel for OptionsModel<'_> {
"save.removeDateTime",
tl!("Leave out the date and time of comments and tracked changes when saving"),
settings.remove_date_time,
)
.help(tl!("The document you are editing keeps the names and dates; only the saved file leaves them out.")),
),
],
),
],
);
)
.footnote(tl!("AutoSave writes your changes to the file a moment after you stop typing."));
let language = page_of(
"language",
@@ -490,7 +486,11 @@ impl PreferencesModel for OptionsModel<'_> {
GroupSpec::new(
Some(tl!("Dictionaries")),
vec![
RowSpec::new("language.dictionariesFolder", tl!("Dictionaries folder:"), RowKind::Custom)
RowSpec::new(
"language.dictionariesFolder",
tl!("Dictionaries folder:"),
RowKind::Text(prefs.dictionaries_folder.as_deref().unwrap_or("")),
)
.help(tl!("Hunspell .aff and .dic files here (pl_PL, pt_BR, it_IT, hr_HR, tr_TR) are used before the system's.\nAn installed Language pack is used after this folder.")),
custom("language.dictionaryFiles", tl!("Dictionary files")),
],
@@ -523,7 +523,12 @@ impl PreferencesModel for OptionsModel<'_> {
GroupSpec::new(
Some(tl!("Read Aloud")),
vec![
RowSpec::new("accessibility.readAloudSpeed", tl!("Speed"), RowKind::Custom),
RowSpec::new(
"accessibility.readAloudSpeed",
tl!("Speed"),
RowKind::float(app.session.read_aloud.rate() as f64, (MIN_RATE as f64)..=(MAX_RATE as f64), 2),
)
.step(0.05),
b("accessibility.skipCitations", tl!("Skip citations & bibliography"), app.session.read_aloud.skip_citations),
],
),
@@ -581,8 +586,12 @@ impl PreferencesModel for OptionsModel<'_> {
groups.push(GroupSpec::new(
Some(tl!("File locations")),
vec![
RowSpec::new("advanced.templatesFolder", tl!("User templates:"), RowKind::Custom)
.help(tl!("File › New lists the .dotx and .dotm templates here under Personal; Save as Word Template starts here.")),
RowSpec::new(
"advanced.templatesFolder",
tl!("User templates:"),
RowKind::Text(prefs.user_templates_folder.as_deref().unwrap_or("")),
)
.help(tl!("File › New lists the .dotx and .dotm templates here under Personal; Save as Word Template starts here.")),
],
));
}
@@ -701,15 +710,6 @@ impl PreferencesModel for OptionsModel<'_> {
"general.defaultApp" => default_app_row(self.app, ui),
"proofing.autoCorrect" => self.command_button(ui, tl!("AutoCorrect Options"), "tools.autocorrect"),
"proofing.customDictionaryFile" => self.custom_dictionary_file(ui),
"language.dictionariesFolder" => {
let saved = self.app.session.prefs.dictionaries_folder.clone().unwrap_or_default();
self.folder_row(ui, key, tl!("Dictionaries folder:"), saved, tl!("Not set: the system's usual places").to_string())
}
"advanced.templatesFolder" => {
let saved = self.app.session.prefs.user_templates_folder.clone().unwrap_or_default();
let default = self.app.services.templates_dir.as_ref().map(|d| d.to_string_lossy().into_owned());
self.folder_row(ui, key, tl!("User templates:"), saved, default.unwrap_or_else(|| tl!("Not set").to_string()))
}
"proofing.customDictionary" => self.custom_dictionary(ui),
"language.proofingLanguage" => {
Text::new(self.strings.proofing_language.clone()).role(TypeRole::Caption).shade(Shade::Faint).show(ui);
@@ -724,7 +724,6 @@ impl PreferencesModel for OptionsModel<'_> {
dictionary_files(ui);
false
}
"accessibility.readAloudSpeed" => self.read_aloud_speed(ui),
"advanced.customizeKeyboard" => self.command_button(ui, tl!("Customize…"), "tools.customizeKeyboard"),
"advanced.customizeRibbon" => self.command_button(ui, tl!("Customize…"), "tools.customizeRibbon"),
_ => false,
@@ -733,6 +732,7 @@ impl PreferencesModel for OptionsModel<'_> {
fn custom_page(&mut self, ui: &mut Ui, page: &str) -> bool {
if page == "agents" {
Text::new(tl!("Agents")).role(TypeRole::Heading).show(ui);
Text::new(tl!("Every command is available to scripts and AI agents: run `wordcraft-cli mcp` for an MCP server, or start the app with `--control <port>` for the JSON control channel."))
.show(ui);
}
@@ -769,56 +769,6 @@ impl OptionsModel<'_> {
clicked
}
/// The Read Aloud speed: a slider with its number, as the player's.
fn read_aloud_speed(&mut self, ui: &mut Ui) -> bool {
use wordcraft_engine::speech::{MAX_RATE, MIN_RATE};
let rate = f64::from(self.app.session.read_aloud.rate());
let out = SliderField::new(tl!("Speed"), Bind::given(rate), f64::from(MIN_RATE)..=f64::from(MAX_RATE))
.step(0.05)
.layout(SliderFieldLayout::Inline)
.short(true)
.unit(tl!("×"))
.show(ui);
// Committed, not live, so a drag doesn't restart the sentence on every frame.
let committed = out.edit.events.committed().copied();
if let Some(v) = committed {
self.set("accessibility.readAloudSpeed", PrefValue::Float(v));
}
committed.is_some()
}
/// A folder setting (v0.19.1's): the saved path or a placeholder, Apply (or Enter) saves the typed path,
/// Clear returns to the default. The draft follows the saved path whenever that changes.
fn folder_row(&mut self, ui: &mut Ui, key: &str, label: &'static str, saved: String, placeholder: String) -> bool {
#[derive(Clone, Default)]
struct Draft {
text: String,
seen: Option<String>,
}
let mut changed = false;
Row::new().id_salt(key).show(ui, |ui, cx| {
let draft = &mut cx.keep::<Draft>();
if draft.seen.as_deref() != Some(saved.as_str()) {
draft.text = saved.clone();
draft.seen = Some(saved.clone());
}
let out = TextField::new(label, Bind::bound(&mut draft.text)).limit(None).placeholder(placeholder.clone()).submits().show(ui);
let typed = draft.text.trim().to_string();
let differs = typed != saved;
let apply = Button::new(tl!("Apply")).enabled(differs).show(ui).clicked() || (out.submitted && differs);
let clear = Button::new(tl!("Clear")).enabled(!saved.is_empty()).show(ui).clicked();
if apply {
self.set(key, PrefValue::Text(typed));
changed = true;
} else if clear {
self.set(key, PrefValue::Text(String::new()));
draft.text.clear();
changed = true;
}
});
changed
}
fn custom_dictionary_file(&mut self, ui: &mut Ui) -> bool {
let saved = self.app.session.prefs.custom_dictionary.clone().unwrap_or_default();
let out = TextField::new(tl!("Dictionary file:"), Bind::given(saved)).limit(None).show(ui);
-85
View File
@@ -454,88 +454,3 @@ fn escape_does_not_commit_the_custom_dictionary_path() {
assert_eq!(dictionary_field_text(&h), "", "the field shows the saved (empty) path");
let _ = std::fs::remove_dir_all(&dir);
}
/// #7987: the Read Aloud speed is a slider, not only a number box.
#[test]
fn read_aloud_speed_is_a_slider() {
use egui_kittest::kittest::Queryable;
let h = options_harness(app(), system_reducing_motion(false));
let _ = h.get_by_role_and_label(egui::accesskit::Role::Slider, "Speed");
}
/// #7987: the Agents page names itself once.
#[test]
fn agents_page_has_one_heading() {
use egui_kittest::kittest::Queryable;
let mut a = app();
a.run("ui.backstage", json!({"value": true, "page": "options", "pane": "agents"})).unwrap();
let mut h = crate::test_harness::builder().build_ui_state(
|ui, app: &mut WordApp| {
let ctx = ui.ctx().clone();
app.logic(&ctx);
app.ui(ui);
},
a,
);
options_frames(&mut h, 3);
use egui_kittest::kittest::NodeT;
// The nav entry is a list item; every other node that carries the name is a title.
let titles = h.query_all_by_label("Agents").filter(|n| n.accesskit_node().role() != egui::accesskit::Role::ListItem).count();
assert_eq!(titles, 2, "the page's group and its title, no second heading");
}
/// #7987: a hint sits under the setting it explains, not in a page footnote at the bottom.
#[test]
fn display_and_save_hints_sit_under_their_rows() {
let mut a = app();
let (display, save, privacy) = with_model(&mut a, true, |m| {
let pages = m.pages();
let help_of = |page: &str, key: &str| {
let p = pages.iter().find(|p| p.id == page).expect("page");
let r = p.groups.iter().flat_map(|g| g.rows.iter()).find(|r| r.key == key).expect("row");
(p.footnote.is_none(), r.help.is_some())
};
(help_of("display", "display.allMarks"), help_of("save", "save.autosave"), help_of("save", "save.removeDateTime"))
});
assert_eq!(display, (true, true));
assert_eq!(save, (true, true));
assert_eq!(privacy, (true, true), "the Privacy hint under its row");
}
/// #7987: a folder setting has Apply and Clear. Typing alone saves nothing, Apply saves the typed path, and Clear
/// returns to the default.
#[test]
fn folder_settings_have_apply_and_clear() {
use egui_kittest::kittest::Queryable;
let dir = std::env::temp_dir().join(format!("wc-ui-folder-row-{}", std::process::id()));
std::fs::create_dir_all(&dir).unwrap();
let path = dir.to_string_lossy().into_owned();
for (pane, label, saved) in [
("advanced", "User templates:", (|a: &WordApp| a.session.prefs.user_templates_folder.clone()) as fn(&WordApp) -> Option<String>),
("language", "Dictionaries folder:", |a: &WordApp| a.session.prefs.dictionaries_folder.clone()),
] {
let mut a = app();
a.run("ui.backstage", json!({"value": true, "page": "options", "pane": pane})).unwrap();
let mut h = crate::test_harness::builder().build_ui_state(
|ui, app: &mut WordApp| {
let ctx = ui.ctx().clone();
app.logic(&ctx);
app.ui(ui);
},
a,
);
options_frames(&mut h, 3);
h.get_by_role_and_label(egui::accesskit::Role::TextInput, label).focus();
options_frames(&mut h, 2);
h.get_by_role_and_label(egui::accesskit::Role::TextInput, label).type_text(&path);
options_frames(&mut h, 3);
assert_eq!(saved(h.state()), None, "{label} typing alone saved");
h.get_by_label("Apply").click();
options_frames(&mut h, 3);
assert_eq!(saved(h.state()).as_deref(), Some(path.as_str()), "{label} Apply");
h.get_by_label("Clear").click();
options_frames(&mut h, 3);
assert_eq!(saved(h.state()), None, "{label} Clear");
}
let _ = std::fs::remove_dir_all(&dir);
}
+1 -1
View File
@@ -61,7 +61,7 @@ pub(super) fn smart_art_design(row: &mut RibbonRow<'_>, app: &mut WordApp) {
let on = layouts.iter().position(|l| *l == g.layout);
let colors = g.colors;
let theme = &theme;
let line = craft::ui::style::rgba_color(craft::ui::runtime::env::Env::of(ui).tokens.color.text.muted);
let line = ui.visuals().weak_text_color();
let picked = pick_tile(ui, tl!("Layouts"), 4, CaptionPlace::None, on, layouts.len(), |at| match layouts.get(at).copied() {
Some(layout) => Tile::new(tl!(layout.label()).to_string())
.thumb(ThumbAspect::new(46, 31), move |cx, r| crate::dialogs_smart_art::preview(cx, r, layout, colors, theme, line)),
+3
View File
@@ -476,6 +476,9 @@ impl Tokens {
on_close: Color32::WHITE,
}
}
pub fn get(ctx: &egui::Context) -> Tokens {
if ctx.global_style().visuals.dark_mode { Tokens::dark() } else { Tokens::light() }
}
}
/// Add `faces` after every other font of the interface families.
+1 -4
View File
@@ -922,13 +922,10 @@ fn check_doctypes(pkg: &Package, acc: &mut Acc) {
/// The adverse non-relationships roles in the isolated, closure, and forms probe series.
fn is_measured_adverse_doctype(form: scan::DoctypeForm, content_type: Option<&str>) -> bool {
// Windows Word refuses a settings part with a DOCTYPE however its content type is cased (#7736 K3/K4).
if content_type.is_some_and(|ct| ct.eq_ignore_ascii_case(package::SETTINGS_CONTENT_TYPE)) {
return true;
}
match content_type {
Some(
package::STYLES_CONTENT_TYPE
| package::SETTINGS_CONTENT_TYPE
| package::FONT_TABLE_CONTENT_TYPE
| package::THEME_CONTENT_TYPE
| package::NUMBERING_CONTENT_TYPE
-23
View File
@@ -503,29 +503,6 @@ fn xml_doctype_internal_entity_in_diagram_definitions_warns() {
}
}
#[test]
fn xml_doctype_in_settings_grades_the_same_whatever_the_content_type_casing() {
// #7736 K3/K4: Windows Word refuses both packages; the grade must not depend on the Override's casing.
let exact = "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml";
let varied = "application/vnd.openxmlformats-officedocument.Wordprocessingml.Settings+XML";
let grade = |content_type: &str| {
let mut doc = Doc::minimal();
doc.set_doc_rels(
r#"<Relationship Id="rSet" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml"/>"#,
);
doc.add_with_override(
"word/settings.xml",
content_type,
r#"<!DOCTYPE w:settings [<!ENTITY greeting "hello">]><w:settings xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"/>"#,
);
let report = validate(&doc);
let finding = assert_finding(&report, "XML-DOCTYPE", Some("word/settings.xml"));
(finding.severity, finding.evidence)
};
assert_eq!(grade(exact), (Severity::Error, Evidence::Observed));
assert_eq!(grade(varied), grade(exact));
}
#[test]
fn xml_doctype_attlist_in_diagram_layout_warns() {
let mut doc = Doc::minimal();
+27 -20
View File
@@ -2,30 +2,30 @@
> **Validation status:** 2026-11-12 · minor · #5875 round 18: package entry and availability lookups carry explicit absence/unknown states; the observation gate resolves bounded helper/accessor aliases and pins completeness predicates and reader derives. Qualified standard macros and four inert attributes are supported; named-field bindings and trait bodies remain closed grammar. Synthetic controls only; independent endpoint review remains required and readiness estimates are unchanged.
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (#3693: additional Delete Previous Sentence command and shortcut; Word-parity estimates unchanged); previously minor (M15: Arabic mirrored UI #1195; 28 UI languages; Hebrew UI and native IME acceptance remain open); previously trivial (HTML import keeps preformatted lines with CR, CRLF or LF input newlines (#4810); numeric character references retain their separate meaning; readiness estimates unchanged; previously trivial: egui 0.37 migration: 27 interface languages remain pinned by `craft-i18n.rev` (9205108…), and the input-method handling has synthetic regressions while managed CI passed and native acceptance (#155–#164) remains open; previously trivial: M6: Manage Sources imports Word's `Sources.xml`, #2640; previously minor: Czech proofing review fixes; previously minor: Portuguese proofing; previously minor: Polish interface and Polish proofing; previously trivial: M7: formatting revisions landed, #41; previously trivial: M5: Draw Table and Eraser landed, #303; previously minor: beta distance restated: ~15 points, ~150–230 h; previously: alpha gate checked: six core workflows pass; previously major: milestones moved here from ROADMAP.md; Current focus set from the re-measured gaps) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4
> **Last reviewed:** 2026-11-28 · **Last updated:** 2026-11-28 · **Change:** minor (beta distance re-measured after the craft-ui port: ~175–275 h, was ~150–230 h; ready for real work ~63%, was ~60%; see [`target-app-parity.md`](target-app-parity.md)); previously minor (Roadmap and parity summary refreshed against the 28 Nov parity run (#7969): catalog coverage 510 / 522 (97.7%), measured counts redone, craft-ui port (#7101) and its tracker (#7671) recorded; readiness estimates unchanged); previously minor (#3693: additional Delete Previous Sentence command and shortcut; Word-parity estimates unchanged); previously minor (M15: Arabic mirrored UI #1195; 28 UI languages; Hebrew UI and native IME acceptance remain open); previously trivial (HTML import keeps preformatted lines with CR, CRLF or LF input newlines (#4810); numeric character references retain their separate meaning; readiness estimates unchanged; previously trivial: egui 0.37 migration: 27 interface languages remain pinned by `craft-i18n.rev` (9205108…), and the input-method handling has synthetic regressions while managed CI passed and native acceptance (#155–#164) remains open; previously trivial: M6: Manage Sources imports Word's `Sources.xml`, #2640; previously minor: Czech proofing review fixes; previously minor: Portuguese proofing; previously minor: Polish interface and Polish proofing; previously trivial: M7: formatting revisions landed, #41; previously trivial: M5: Draw Table and Eraser landed, #303; previously minor: beta distance restated: ~15 points, ~150–230 h; previously: alpha gate checked: six core workflows pass; previously major: milestones moved here from ROADMAP.md; Current focus set from the re-measured gaps) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4
Forward-looking plan. The summary is [`ROADMAP.md`](../ROADMAP.md); the ranked work list is
[`gaps.md`](gaps.md); the numbers are in [`target-app-parity.md`](target-app-parity.md). Hours are
Opus 5.5 agent wall-clock.
## Current focus (toward beta, ~150–230 h)
## Current focus (as of 2026-11-28)
1. **Merge or close the ~45 open PRs** before starting overlapping work: many close catalog gaps
(Clipboard pane #264, Manage Styles #270, Group #267), fix field bugs (Hebrew RTL #20, IME
fixes #155–#164) or add languages (nb, nn, he). Owner review needed.
2. **DOCX real-world corpus** (gap #1, 30–50 h): collect openly licensed real-world .docx files,
open/render/round-trip them, compare with Word locally, fix what breaks. Omitted/empty
paragraph defaults now have synthetic save/reopen coverage; the corpus gate remains open.
3. **Preserve what we can't render** (gap #2, 10–15 h): remaining native ink forms and unsupported
graphics survive a round trip. Drawing-level native ink now keeps its InkML and optional picture
fallback alongside chart, SmartArt, OLE and drawing-canvas support.
4. **Stability sweep** (gap #3, 20–30 h): the open crash, hang and write-failure issues, plus an
autosave/recovery soak test. Local desktop recovery is implemented; cross-platform field
validation and longer soak testing remain. See [recovery.md](recovery.md).
5. **Pagination fidelity** (gap #4, 30–50 h): column balancing, footnote continuation, compat
options, a local page-by-page comparison harness; an owner decision on an Aptos-metric font.
6. **Formatting revisions and content controls** (gap #5, 12–18 h), **native printing** (gap #6,
6–10 h), **dialog depth** (gap #7, 20–30 h).
The craft-ui port (#7101) landed, and v0.18.0, v0.18.1 and v0.19.1 are released. The port left
regressions. Epic #7671 is the live tracker: 59 sub-issues, 14 closed. Order of work:
1. **Finish #7671.** First the two P0s: multi-window data loss (#7822, closing a window can close
the wrong document and the save prompt can lock up) and screen readers (#7823). Then the 27 Nov
comparison batch (#7970–#7989, #8017–#8022), which is in review.
2. **One craft-libs repin PR.** craft-libs fixes now land on craft-libs `main`; `next` is gone.
WordCraft gets them through a single `rev` move, then a small PR switches on the new options.
3. **Then the beta gaps.** With #7671 (~25–45 h) they put beta ~175–275 h away (estimated,
re-measured 2026-11-28 against main `6fbf780789`; ready for real work is ~63%, beta is ~75%):
DOCX real-world corpus (gap #1), preserving unrendered content (gap #2), a stability sweep
(gap #3), pagination fidelity (gap #4), formatting revisions and content controls (gap #5),
print dialog depth (gap #6; native printing itself landed, #783) and dialog depth (gap #7). Details and hours are in
[`gaps.md`](gaps.md).
Open PRs: 1,535 as of 2026-11-28 (`gh api search/issues` with `repo:storytold/wordcraft is:pr is:open`, `total_count`). Owner review is the bottleneck.
## Alpha gate (core workflows)
@@ -45,6 +45,11 @@ every day, checked end to end on the main platform (macOS desktop), including sa
**Result: passes.** Every core workflow completes on macOS and the work saves and reopens; the
partial rows are fidelity gaps (beta work), not broken workflows. WordCraft stays **alpha**.
**Not re-verified.** This table was checked before the craft-ui port (#7101). It has not been
re-run on main. It needs re-checking after the P0s in #7671 are fixed. Multi-window risk (#7822):
closing a window can close the wrong document, so the "Write and format" and "Share or print"
rows (save, close, reopen) are at risk until it is fixed.
## Milestones
| # | Milestone | State | Remaining |
@@ -63,8 +68,8 @@ partial rows are fidelity gaps (beta work), not broken workflows. WordCraft stay
| M11 | Draw and objects | text wrap, text boxes, canvas handles, rotation (#332), ink pens and eraser (#307), contour wrap (#354), lasso, Add Pen, Ink to Shape and Ink Replay (#395) done; Ink to Math, grouping missing | 35–55 h |
| M12 | Formats breadth (PDF, ODT, RTF, HTML, MD, TXT, LaTeX, `.doc` import) | done (first versions); `.doc` write, encryption, minor formats missing | 60–100 h |
| M13 | Performance budgets | on track (1.4 ms relayout); large real-world documents unmeasured | 10–20 h |
| M14 | 1.0 polish, packaging, signing | releases v0.1.0–v0.4.0 published (signed macOS, Windows MSI x64/x86/arm64, Linux, FreeBSD, web) | — |
| M15 | Localization (12 key languages, RTL interface, proofing languages) | 28 UI languages from the shared catalogs pinned by `craft-i18n.rev` (Arabic mirrored UI #1195); proofing: English, Polish, Portuguese, Italian, Croatian, Turkish, Russian, Czech, Indonesian and Spanish, plus Bulgarian and German hyphenation only; Hebrew UI, native-speaker review and native IME acceptance (#155–#164) remain open | 55–95 h |
| M14 | 1.0 polish, packaging, signing | releases v0.1.0–v0.19.1 published (latest v0.19.1, 2026-11-25; signed macOS, Windows MSI x64/x86/arm64, Linux, FreeBSD, web) | — |
| M15 | Localization (12 key languages, RTL interface, proofing languages) | 36 locales with a `wordcraft.tsv` in the shared catalogs pinned by `craft-i18n.rev` (counted with `git ls-tree` at that rev, 2026-11-28; Arabic mirrored UI #1195); proofing: English, Polish, Portuguese, Italian, Croatian, Turkish, Russian, Czech, Indonesian and Spanish, plus Bulgarian and German hyphenation only; Hebrew UI, native-speaker review and native IME acceptance (#155–#164) remain open | 55–95 h |
| M16 | Right-to-left and East Asian typography | RTL paragraphs done (#207) | 30–45 h |
## Next after beta
@@ -76,6 +81,8 @@ languages, screen-reader access, ecosystem decisions (VBA, add-ins, cloud), an i
| Date | Change | Summary |
|---|---|---|
| 2026-11-28 | minor | Current focus: beta distance re-measured after the craft-ui port, ~175–275 h (was ~150–230 h): the #7671 work (~25–45 h) added to the beta gaps; ready for real work ~63% (was ~60%) |
| 2026-11-28 | minor | Current focus rewritten: craft-ui port (#7101) landed, epic #7671 first, then one craft-libs repin, then the beta gaps; open PR count restated (1,535); alpha gate marked not re-verified since the port; M14 releases and M15 locale count updated. Readiness estimates unchanged. |
| 2026-11-12 | minor | #5875 round 18: package entry and availability lookups carry explicit absence/unknown states; the observation gate resolves bounded helper/accessor aliases and pins completeness predicates and reader derives. Qualified standard macros and four inert attributes are supported; named-field bindings and trait bodies remain closed grammar. Synthetic controls only; independent endpoint review remains required and readiness estimates are unchanged. |
| 2026-11-03 | trivial | DOCX text-frame anchor locks survive JSON and two save/reopen cycles, including position and size edits |
| 2026-11-03 | minor | M15: Arabic mirrored interface (#1195); 28 UI languages from craft-i18n; Hebrew UI, native-speaker review and native IME acceptance (#155–#164) remain open |
+97 -84
View File
@@ -1,6 +1,6 @@
# WordCraft parity with Microsoft Word
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-07 · **Change:** trivial (Proofing: freestanding custom dictionary file support, #5840; previously trivial: Equations: `\int` + Space leaves ∫ waiting for its limits, `_a^b` then Space builds them, and the operand typed next goes inside, observed in Word for Windows on #4938, #4917; no percentage change; previously trivial: Tables row: Table Properties applies to the selected rows, columns and cells, #4857; no percentage change); previously trivial (Tables row: tables nest 18 deep at most, so a .json save reads back, #3618); previously trivial (Tables row: Table Properties applies to the selected rows, columns and cells, #4857; no percentage change); previously trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (Insert Table of Figures lists any caption label, #3013; previously trivial: Performance row: typing no longer starts render threads on every repaint, #3027; previously trivial: shapes inserted in a row are all kept, #2019; previously trivial: East Asian typography: `w:eastAsianLayout` kept on save, not laid out; previously trivial: Ink to Shape recognises arrows; previously trivial: Windows Magnifier follows the caret onto a new line, #1119; previously trivial: table border drags with Ctrl and Alt, from the left edge and of selected cells, #711; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously trivial: all 12 bibliography styles, #383; previously trivial: formatting revisions landed, #41; previously trivial: Draw Table and Eraser landed, #303; previously minor: readiness table with hours per audience; full number back to the additive weighted sum, 60%; mainstream and essentials numbers added; alpha gate checked; previously major: full re-measure against Word for Mac 16.113.4; replaces the parity tables that lived in ROADMAP.md) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4
> **Last reviewed:** 2026-11-28 · **Last updated:** 2026-11-28 · **Change:** minor (Readiness estimates re-measured against main `6fbf780789` after the craft-ui port (#7101, #7671): full ~60% → ~63%, mainstream ~55% → ~56%, essentials ~63% → ~62%; feature-area and dimension scores re-scored with evidence); previously minor (Roadmap and parity summary refreshed against the 28 Nov parity run (#7969): catalog coverage 510 / 522 (97.7%), measured counts redone, craft-ui port (#7101) and its tracker (#7671) recorded; readiness estimates unchanged); previously trivial (Proofing: freestanding custom dictionary file support, #5840; previously trivial: Equations: `\int` + Space leaves ∫ waiting for its limits, `_a^b` then Space builds them, and the operand typed next goes inside, observed in Word for Windows on #4938, #4917; no percentage change; previously trivial: Tables row: Table Properties applies to the selected rows, columns and cells, #4857; no percentage change); previously trivial (Tables row: tables nest 18 deep at most, so a .json save reads back, #3618); previously trivial (Tables row: Table Properties applies to the selected rows, columns and cells, #4857; no percentage change); previously trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (Insert Table of Figures lists any caption label, #3013; previously trivial: Performance row: typing no longer starts render threads on every repaint, #3027; previously trivial: shapes inserted in a row are all kept, #2019; previously trivial: East Asian typography: `w:eastAsianLayout` kept on save, not laid out; previously trivial: Ink to Shape recognises arrows; previously trivial: Windows Magnifier follows the caret onto a new line, #1119; previously trivial: table border drags with Ctrl and Alt, from the left edge and of selected cells, #711; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously trivial: all 12 bibliography styles, #383; previously trivial: formatting revisions landed, #41; previously trivial: Draw Table and Eraser landed, #303; previously minor: readiness table with hours per audience; full number back to the additive weighted sum, 60%; mainstream and essentials numbers added; alpha gate checked; previously major: full re-measure against Word for Mac 16.113.4; replaces the parity tables that lived in ROADMAP.md) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4
The authoritative assessment of how close WordCraft is to Microsoft Word. [`ROADMAP.md`](../ROADMAP.md)
summarizes it; [`gaps.md`](gaps.md) itemizes every shortfall; the deep checklists are
@@ -11,23 +11,25 @@ The generated ribbon checklist is [`parity-checklist.md`](parity-checklist.md).
Labels → New Document with one label per recipient continues across sheets for all selected recipients (#4880). The final sheet leaves unused labels blank; address mapping, fixed-text and single-label modes stay unchanged. This is label generation, not a new Update Labels or Finish & Merge template workflow. Readiness estimates are unchanged.
## Headline (2026-10-10, origin/main `a99dddc`, v0.4.0 + ~90 merged PRs)
## Headline (2026-11-28, origin/main `6fbf780789`, v0.19.1 + later merges)
| Number | Value | Kind |
|---|---|---|
| Ribbon/menu catalog coverage | **487 / 502 (97.0%)** | **measured**: `cargo xtask parity` (re-derived this pass from `crates/engine/src/catalog.rs` against every `CommandSpec::new` id in the source; identical to the checked-in `parity-checklist.md`) |
| Feature breadth (weighted, beyond the ribbon: dialog options, citation styles, proofing languages, chart types, UI languages) | **~80%** | estimated |
| Feature depth (weighted by use, table below) | **~68%** | estimated |
| **Ready for real work** (full target) | **~60%** (range 55–63%) | estimated: weighted sum over the dimension table ([By dimension](#by-dimension)) |
| **Mainstream practitioner** | **~55%** | estimated, same method |
| **Essentials user** | **~63%** | estimated, same method |
| Remaining effort to beta | **~150–230 h** of Opus 5.5 agent wall-clock: the blocking beta list ([gaps.md](gaps.md) #1–#7), which lifts file formats, layout, stability and UI enough to reach ~75% | estimated |
| Remaining effort to full parity with Word desktop | **~750–1,250 h** | estimated |
| Commands | 431 engine commands (+ `ui.*` commands in the front end) | measured (source count) |
| Tests | 852 `#[test]` functions + 10 `proptest!` blocks | measured (source count) |
| Code | ~88,700 lines of Rust in 15 crates, 3 apps and xtask | measured (`wc -l`) |
| Ribbon/menu catalog coverage | **510 / 522 (97.7%)** | **measured**: `cargo xtask parity`, as written to the checked-in [`parity-checklist.md`](parity-checklist.md) by #7969 (2026-11-28) |
| Feature breadth (weighted, beyond the ribbon: dialog options, citation styles, proofing languages, chart types, UI languages) | **~85%** (was ~80%) | estimated: about 100 dialog names (was 16 modal dialogs), 28 interface languages (was 13), 10 built-in proofing languages (was 5) |
| Feature depth (weighted by use, table below) | **~71%** (was ~68%) | estimated |
| **Ready for real work** (full target) | **~63%** (range 58–66%; was ~60%) | estimated: weighted sum over the dimension table ([By dimension](#by-dimension)) |
| **Mainstream practitioner** | **~56%** (was ~55%) | estimated, same method |
| **Essentials user** | **~62%** (was ~63%) | estimated, same method |
| Remaining effort to beta | **~175–275 h** of Opus 5.5 agent wall-clock (was ~150–230 h): finishing epic #7671 (~25–45 h) plus the blocking beta list ([gaps.md](gaps.md) #1–#7), which lifts file formats, layout, stability and UI enough to reach ~75% | estimated |
| Remaining effort to full parity with Word desktop | **~775–1,300 h** (was ~750–1,250 h; #7671 added) | estimated |
| Commands | 678 distinct engine command ids (+ `ui.*` commands in the front end) | measured (source count: unique ids in `CommandSpec::new("…"` under `crates/engine/src`) |
| Tests | 5,826 `#[test]` functions + 9 `proptest!` lines | measured (source count: `grep` over `crates`, `apps`, `xtask`) |
| Code | ~374,200 lines of Rust in 15 crates, 3 apps and xtask | measured (`wc -l` over every `.rs` file in `crates`, `apps`, `xtask`) |
**Stage: alpha.** All six core workflows pass the [alpha gate](roadmap.md#alpha-gate-core-workflows); see [`ROADMAP.md`](../ROADMAP.md) for why it isn't beta, and the distance.
The percentage estimates in this table and below were re-measured 2026-11-28 against main `6fbf780789`, after the craft-ui port (#7101). Its regressions are tracked in epic #7671 (59 sub-issues, 14 closed). The re-measure used merged PRs since 2026-10-10, open bugs, the companion docs and #7671; nothing was compared against Word page by page. The hours were not re-priced area by area: they are the 2026-10-10 hours plus the #7671 work. The command, test and code counts were re-counted on 2026-11-28; the older numbers (431, 852, ~88,700) used the same kind of count and are out of date, though the earlier counting rules may have differed.
**Stage: alpha.** All six core workflows passed the [alpha gate](roadmap.md#alpha-gate-core-workflows) before the craft-ui port (not re-run since); see [`ROADMAP.md`](../ROADMAP.md) for why it isn't beta, and the distance.
## What we measured against
@@ -45,7 +47,7 @@ Labels → New Document with one label per recipient continues across sheets for
and our knowledge of Word for Windows and Mac (Microsoft 365). Windows-only features (PDF Reflow
open, Works/WordPerfect import) are counted, because a Word user on Windows expects them.
- WordCraft as it is on origin/main today: source (catalog, command registry, readers/writers,
layout), tests, the i18n catalogs, open issues (62 as of 2026-10-10) and open PRs (~45 as of 2026-10-10), git history.
layout), tests, the i18n catalogs, open issues (2,275 as of 2026-11-28) and open PRs (1,535 as of 2026-11-28), git history.
- **Not done this pass:** opening real-world .docx files in both apps and comparing pages. There is
no real-world corpus in the repo (Word-produced files can't be committed), and the disk budget
ruled out building. That comparison is the first gap in [`gaps.md`](gaps.md).
@@ -56,33 +58,31 @@ Percent is depth and fidelity against Word, not presence. Weight is our estimate
typical Word user's time spent in the area (sums to 100). Hours are Opus 5.5 agent wall-clock to
full parity for the area.
| Area | Weight | Parity | Was (2026-10-06) | Hours | Evidence and what's missing |
| 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 still missing (PR #264 open). |
| Character and paragraph formatting | 11 | 82% | 85% | 8–12 | Nearly every property, Font/Paragraph dialogs, character border, Phonetic Guide (#288), Enclose Characters (#297). Kerning for fonts in the Font dialog. Missing: Asian Typography, ligature/stylistic-set options in the Font dialog's Advanced tab. |
| Styles and themes | 8 | 74% | 75% | 8–12 | Gallery, pane, create/modify, style sets, themes. Style Inspector landed (#236). Missing: Manage Styles (#270 open), style separators, linked-style edge cases; Word ships 11 Quick Style sets plus dozens of themes, we ship our own smaller set. |
| Lists | 6 | 78% | 75% | 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. |
| Tables | 8 | 76% | 72% | 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). |
| Page layout and sections | 7 | 70% | 72% | 12–20 | Margins, size, columns, breaks, page borders, line numbers, vertical alignment, drop caps, hyphenation. Columns don't balance; RTL sections missing. Vertical sections (tbRl/btLr) landed (#491). Detail: [layout-parity.md](layout-parity.md). |
| Headers, footers, page numbers, fields | 5 | 70% | 70% | 8–12 | First/even/odd, link to previous, TOC as an updatable field (#52), cross-references to real bookmarks (#227). Field coverage is a subset of Word's ~90 field codes; Field dialog missing. |
| Footnotes and endnotes | 3 | 60% | 60% | 3–5 | Placed and editable, numbers from Word files (#103); long notes continue onto the next page under the continuation separator (#352). Footnote and Endnote dialog with options per section: below text, end of section, number format, start at, restart each section or page, custom mark, convert (#385). |
| References (TOC, citations, bibliography, captions, index, TOA) | 5 | 65% | 60% | 12–20 | Working first versions, Zotero integration (#189), Zotero/Mendeley `ADDIN` fields round-trip. Caption, Index, Mark Entry, Custom TOC, Table of Figures and Create/Edit Source dialogs; updates honour the TOC (`\o \u \t \f \n \p \h`), table of figures (`\c \a \n \p`, any caption label, so a list of tables sits beside a list of figures; #3013), INDEX (`\c \e \h \r`), XE (`\b \i \t \r`) and SEQ/STYLEREF chapter switches (#402); Insert Caption… on the right-click menu of pictures, shapes, text boxes and charts (#1230). All 12 of Word's bibliography styles (APA, MLA, Chicago, IEEE, Harvard, ISO 690 author-date and numerical, Turabian, GB/T 7714, GOST name and title sort, SIST02; #383); bibliography sources saved in DOCX (#790). Manage Sources imports Word's bibliography file (`b:Sources`, `Sources.xml`, #2640). |
| Review (proofing UI, comments, track changes, compare, protect) | 8 | 72% | 75% | 15–25 | Comment balloons, tracked insert/delete incl. paragraph marks (#244, #125), Compare / Combine with comparison settings (case, white space, formatting, tables, word or character level, #412), Restrict Editing pane with formatting and editing restrictions, exceptions for everyone and a password (#412). Formatting revisions (#41): kept in DOCX, recorded while tracking, accepted/rejected, "Formatted: …" balloons and change bars. Moves (#400): kept in DOCX, recorded on a tracked cut and paste, accepted/rejected at either end, green markup and "Moved from/to" balloons. Show revisions in balloons takes tracked deletions in the body out of the text into "Deleted: …" balloons (insertions stay inline, as in Word; deletions in headers, footers, notes and text boxes, and in print and PDF, stay inline). Missing: drag-and-drop moves, insert/delete balloons, Translate, Block Authors, modern comment threads/mentions. Lowered: these gaps are confirmed by source (no `rPrChange` anywhere). |
| Proofing (spelling, grammar, thesaurus, languages) | 5 | 44% | (in Review) | 20–40 | English, Polish, Portuguese, Italian and Czech (system Hunspell, #1048), chosen per run from its language (`w:lang`): English word list (Moby plus our supplement of modern words such as "desktop", #520) and rule-based grammar; Polish against the installed Hunspell dictionary through a Hunspell-style affix engine, Polish grammar rules and TeX hyphenation patterns (2026-10-10); Portuguese (pt-BR) against the installed VERO Hunspell dictionary — the affix engine reads its `FLAG UTF-8` flags, continuation classes and forbidden spellings — with accent-first suggestions, conservative grammar rules and TeX patterns (2026-10-12); Italian (it-IT) against the installed Hunspell dictionary through the same affix engine, with accent-first suggestions and conservative grammar rules. Other languages are left unmarked. The custom dictionary persists across sessions (#40), and freestanding custom dictionary files (such as Microsoft Word's CUSTOM.DIC in UTF-16LE with BOM) can be selected in File › Options › Proofing (#5840). Word ships 120 proofing tools for ~50 languages plus Editor (style refinements, similarity). Issues #25, #40, #100. |
| Mailings | 2 | 70% | 70% | 6–10 | Mail merge from CSV, fields, rules (IF, SKIPIF, NEXT, NEXTIF, evaluated alike in preview and merge), fields in headers/footers (one section per letter), preview, envelopes, labels. Select Recipients takes a typed list or CSV (#247); no Excel/Outlook/Contacts data sources, no email merge. |
| Pictures, shapes, text boxes, WordArt | 6 | 60% | 60% | 20–30 | Insert, crop, recolour, styles, floating placement like Word (#136), wrap (square/top-bottom/behind/front), text boxes edit and overflow (#46), VML text boxes (#242), free rotation and flips with a rotation handle (#332), WordArt: text fill (solid, gradient, none), outline, shadow, glow and reflection with our own styles, and Transform warps along arch, circle, wave, slant, inflate/deflate, chevron and triangle (other presets kept and drawn flat), connectors (straight, elbow, curved, arrowheads) glued to shapes' connection sites and re-routed when those move (#416). Missing: tight/through contour wrap, rotated text-box text, group (#267 open), shape effects, WordArt 3-D/bevel and editing text in its bent form, connector routing around shapes, Drawing Canvas, Icons, online pictures, screenshot. |
| Mailings | 2 | 70% | 70% | 6–10 | Mail merge from CSV, fields, rules (IF, SKIPIF, NEXT, NEXTIF, evaluated alike in preview and merge), fields in headers/footers (one section per letter), preview, envelopes, labels. Select Recipients takes a typed list, CSV (#247) or a sheet of an Excel (.xlsx/.xlsm) or OpenDocument (.ods) workbook, with Select Table to pick the sheet (#334); no Outlook/Contacts/Access data sources, no email merge. |
| Pictures, shapes, text boxes, WordArt | 6 | 60% | 60% | 20–30 | Insert, crop, recolour, styles, floating placement like Word (#136), wrap (square/top-bottom/behind/front), text boxes edit and overflow (#46), VML text boxes (#242), free rotation and flips with a rotation handle (#332), text-box text direction (90°, 270°, stacked), Align Text and linked text boxes (#369), Icons: an original icon library drawn in code with a searchable picker, inserted as pictures and recoloured with Icon Color (#309), Drawing Canvas with Fit/Expand/Scale and DOCX `wpc:wpc` (#344; members edited by command, not yet dragged inside the canvas; the canvas rotates and flips as a whole). Missing: tight/through contour wrap, text in a freely rotated text box, group (#267 open), shape effects, WordArt, connectors, online pictures, screenshot. |
| Equations | 1 | 75% | 20% (with Draw) | 4–8 | OMML read/write, OpenType MATH layout, in-place editor with an Equation tab (#191); typed `\int`, `\sum`… + Space wait for their limits (`_a^b`), any character that can't continue `\name` corrects it (`\int_0^1`), and an operator built without an operand takes the caret into it, as observed in Word for Windows on #4938 (#4917, `equation::tests::an_autocorrected_operator_waits_for_its_limits`). Missing: line breaking of long display equations, ink equations. |
| Charts, SmartArt, Draw/ink, 3D models, icons | 4 | 3% | (20% with equations) | 70–110 | Icons landed (#309; an original library drawn in code). Draw: pens, pencil, highlighter, stroke eraser and Hide Ink (#307), ink saved as DrawingML freeforms; Lasso Select (move, recolour, delete), Add Pen gallery, Ink to Shape (line, arrow, rectangle, ellipse, triangle, polygon) and Ink Replay (#395); Ink to Math, pressure and Word's own InkML missing; charts: Insert › Chart makes column, bar (clustered and stacked), line, area, pie, doughnut and scatter charts with Chart Design (change type, Edit Data grid, title, legend, data labels) and saves them as real chart parts (#409); charts from Word are drawn (#292) and kept on save (#319) but stay read-only; SmartArt is drawn and kept (#292, #319); Insert › SmartArt (#497) creates and edits list, process, cycle, hierarchy, pyramid, radial, matrix and Venn graphics with our own layouts, a Text Pane and the SmartArt Design tab, saved as diagram parts with the drawing; SmartArt from other programs stays read-only. |
| View (modes, zoom, panes, windows) | 3 | 72% | 70% | 6–10 | Print/web/draft/read/focus, dark page (#194), pages side by side when zoomed out (#251), navigation pane; Outline view with the Outlining tab: levels, promote/demote, moving with collapsed content, expand/collapse, Show Level, first line only, text formatting (#493). Switch Windows, Arrange All, View Side by Side and Synchronous Scrolling across the native windows (#322). Missing: Split, Master Document, Immersive Reader depth. |
| Backstage, printing, options | 3 | 58% | 55% | 12–20 | New/Home pages (#254), save prompts (#151), web printing via the browser (#209). Desktop printing still goes through PDF; Options has a fraction of Word's panes. |
| Right-to-left and complex scripts | 1 | 50% | 55% | 15–25 | UAX #9, Arabic shaping, RTL paragraphs (#207). No RTL sections/tables, kashida justification or mirrored UI; open bug reports (#215, #211, #199, #66, #63, #48, #19) need re-testing against #207. |
| East Asian typography | 1 | 25% | not rated | 13–22 | IME input works (winit fixes pending, #155–#164). Vertical text in sections, text boxes and cells with upright ideographs (#491; no `vert` glyph alternates). Ruby/Phonetic Guide with DOCX round trip (#288); document grid (lines per page, characters per line, #391). Two lines in one and horizontal in vertical (`w:eastAsianLayout`) are kept on save but not laid out. No enclose characters, Asian line-break options. |
| Accessibility | 1 | 50% | not rated | 10–18 | AccessKit enabled in eframe. Alt Text pane for pictures, shapes, text boxes, groups, charts and tables with Mark as decorative, all round-tripping in DOCX (#386). The Accessibility pane groups errors, warnings and tips with jump-to and one-click fixes; rules for alt text, heading order, header rows, blank table rows/columns, merged cells, low contrast (WCAG ratio), floating objects and blank paragraphs. Screen-reader access to the document canvas is still untested (#18); no reading-order tools. The document canvas describes its text, headings, lists, tables, links, pictures and caret to screen readers through AccessKit (#488); Windows Magnifier follows the caret, onto a new line too (#1119). |
| 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. |
| 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). |
| Page layout and sections | 7 | 74% | 70% | 12–20 | Margins, size, columns, breaks, page borders, line numbers, vertical alignment, drop caps, hyphenation. Vertical sections (tbRl/btLr) landed (#491). Detail: [layout-parity.md](layout-parity.md). **2026-11-28:** Up: newspaper columns balance (#353, #6821) and RTL sections landed (#362). |
| Headers, footers, page numbers, fields | 5 | 74% | 70% | 8–12 | First/even/odd, link to previous, TOC as an updatable field (#52), cross-references to real bookmarks (#227). Field coverage is a subset of Word's ~90 field codes. **2026-11-28:** Up: field codes shown, edited, locked and stepped through (#349) and a Field dialog (#5062). |
| Footnotes and endnotes | 3 | 60% | 60% | 3–5 | Placed and editable, numbers from Word files (#103); long notes continue onto the next page under the continuation separator (#352). Footnote and Endnote dialog with options per section: below text, end of section, number format, start at, restart each section or page, custom mark, convert (#385). **2026-11-28:** No change: small fixes only (#2647, #1663). |
| References (TOC, citations, bibliography, captions, index, TOA) | 5 | 65% | 65% | 12–20 | Working first versions, Zotero integration (#189), Zotero/Mendeley `ADDIN` fields round-trip. Caption, Index, Mark Entry, Custom TOC, Table of Figures and Create/Edit Source dialogs; updates honour the TOC (`\o \u \t \f \n \p \h`), table of figures (`\c \a \n \p`, any caption label, so a list of tables sits beside a list of figures; #3013), INDEX (`\c \e \h \r`), XE (`\b \i \t \r`) and SEQ/STYLEREF chapter switches (#402); Insert Caption… on the right-click menu of pictures, shapes, text boxes and charts (#1230). All 12 of Word's bibliography styles (APA, MLA, Chicago, IEEE, Harvard, ISO 690 author-date and numerical, Turabian, GB/T 7714, GOST name and title sort, SIST02; #383); bibliography sources saved in DOCX (#790). Manage Sources imports Word's bibliography file (`b:Sources`, `Sources.xml`, #2640). **2026-11-28:** No change: inserting a citation mid-paragraph deletes the rest of it (#7045, critical, open). |
| Review (proofing UI, comments, track changes, compare, protect) | 8 | 72% | 72% | 15–25 | Comment balloons, tracked insert/delete incl. paragraph marks (#244, #125), Compare / Combine with comparison settings (case, white space, formatting, tables, word or character level, #412), Restrict Editing pane with formatting and editing restrictions, exceptions for everyone and a password (#412). Formatting revisions (#41): kept in DOCX, recorded while tracking, accepted/rejected, "Formatted: …" balloons and change bars. Moves (#400): kept in DOCX, recorded on a tracked cut and paste, accepted/rejected at either end, green markup and "Moved from/to" balloons. Show revisions in balloons takes tracked deletions in the body out of the text into "Deleted: …" balloons (insertions stay inline, as in Word; deletions in headers, footers, notes and text boxes, and in print and PDF, stay inline). Missing: drag-and-drop moves, insert/delete balloons, Translate, Block Authors, modern comment threads/mentions. Lowered: these gaps are confirmed by source (no `rPrChange` anywhere). **2026-11-28:** No change: Compare still loses content in several cases (#6273, #5571, #3749, open). |
| Proofing (spelling, grammar, thesaurus, languages) | 5 | 52% | 44% | 20–40 | English, Polish, Portuguese, Italian and Czech (system Hunspell, #1048), chosen per run from its language (`w:lang`): English word list (Moby plus our supplement of modern words such as "desktop", #520) and rule-based grammar; Polish against the installed Hunspell dictionary through a Hunspell-style affix engine, Polish grammar rules and TeX hyphenation patterns (2026-10-10); Portuguese (pt-BR) against the installed VERO Hunspell dictionary — the affix engine reads its `FLAG UTF-8` flags, continuation classes and forbidden spellings — with accent-first suggestions, conservative grammar rules and TeX patterns (2026-10-12); Italian (it-IT) against the installed Hunspell dictionary through the same affix engine, with accent-first suggestions and conservative grammar rules. Other languages are left unmarked. The custom dictionary persists across sessions (#40), and freestanding custom dictionary files (such as Microsoft Word's CUSTOM.DIC in UTF-16LE with BOM) can be selected in File › Options › Proofing (#5840). Word ships 120 proofing tools for ~50 languages plus Editor (style refinements, similarity). Issues #25, #40, #100. **2026-11-28:** Up: 10 built-in proofing languages (was 5; [gaps.md](gaps.md) #8) and Language packs in Options (#5208, #5515). Still far from Word's ~50. |
| Mailings | 2 | 70% | 70% | 6–10 | Mail merge from CSV, fields, rules (IF, SKIPIF, NEXT, NEXTIF, evaluated alike in preview and merge), fields in headers/footers (one section per letter), preview, envelopes, labels. Select Recipients takes a typed list, CSV (#247) or a sheet of an Excel (.xlsx/.xlsm) or OpenDocument (.ods) workbook, with Select Table to pick the sheet (#334); no Outlook/Contacts/Access data sources, no email merge. **2026-11-28:** No change: no new data sources landed. |
| Pictures, shapes, text boxes, WordArt | 6 | 64% | 60% | 20–30 | Insert, crop, recolour, styles, floating placement like Word (#136), wrap (square/top-bottom/behind/front), text boxes edit and overflow (#46), VML text boxes (#242), free rotation and flips with a rotation handle (#332), text-box text direction (90°, 270°, stacked), Align Text and linked text boxes (#369), Icons: an original icon library drawn in code with a searchable picker, inserted as pictures and recoloured with Icon Color (#309), Drawing Canvas with Fit/Expand/Scale and DOCX `wpc:wpc` (#344; members edited by command, not yet dragged inside the canvas; the canvas rotates and flips as a whole). Missing: text in a freely rotated text box, shape effects, WordArt, connectors, online pictures, screenshot. **2026-11-28:** Up: Group (#267, #323) and Tight/Through contour wrap (#354) landed; Format Shape pane gained Line and Layout sections (#5896). |
| Equations | 1 | 78% | 75% | 4–8 | OMML read/write, OpenType MATH layout, in-place editor with an Equation tab (#191); typed `\int`, `\sum`… + Space wait for their limits (`_a^b`), any character that can't continue `\name` corrects it (`\int_0^1`), and an operator built without an operand takes the caret into it, as observed in Word for Windows on #4938 (#4917, `equation::tests::an_autocorrected_operator_waits_for_its_limits`). Missing: ink equations. **2026-11-28:** Up: long display equations wrap at operators (#326). The port broke the Equation tab galleries (#7975). |
| Charts, SmartArt, Draw/ink, 3D models, icons | 4 | 30% | 3% | 70–110 | Icons landed (#309; an original library drawn in code). Draw: pens, pencil, highlighter, stroke eraser and Hide Ink (#307), ink saved as DrawingML freeforms; Lasso Select (move, recolour, delete), Add Pen gallery, Ink to Shape (line, arrow, rectangle, ellipse, triangle, polygon) and Ink Replay (#395); Ink to Math, pressure and Word's own InkML missing; charts: Insert › Chart makes column, bar (clustered and stacked), line, area, pie, doughnut and scatter charts with Chart Design (change type, Edit Data grid, title, legend, data labels) and saves them as real chart parts (#409); charts from Word are drawn (#292) and kept on save (#319) but stay read-only; SmartArt is drawn and kept (#292, #319); Insert › SmartArt (#497) creates and edits list, process, cycle, hierarchy, pyramid, radial, matrix and Venn graphics with our own layouts, a Text Pane and the SmartArt Design tab, saved as diagram parts with the drawing; SmartArt from other programs stays read-only. **2026-11-28:** Re-scored from 3%, which predates Insert › Chart (#409) and Insert › SmartArt (#497): WordCraft's own charts and SmartArt are editable, Word's are drawn and kept (#292, #319) but read-only. The port broke the Insert Diagram dialog and Diagram Design tab (#7973, #7974). |
| View (modes, zoom, panes, windows) | 3 | 70% | 72% | 6–10 | Print/web/draft/read/focus, dark page (#194), pages side by side when zoomed out (#251), navigation pane; Outline view with the Outlining tab: levels, promote/demote, moving with collapsed content, expand/collapse, Show Level, first line only, text formatting (#493). Switch Windows, Arrange All, View Side by Side and Synchronous Scrolling across the native windows (#322). Missing: Split, Master Document, Immersive Reader depth. **2026-11-28:** Down: port regressions in the View tab and Read Mode (#7985, #7988, #8019, #8020); #7988 fixed by #8025. |
| Backstage, printing, options | 3 | 64% | 58% | 12–20 | New/Home pages (#254), save prompts (#151), web printing via the browser (#209). Desktop printing still goes through PDF; Options has a fraction of Word's panes. **2026-11-28:** Up: native printing through craft-print (#783) with N-up, booklets and scale to paper (#641, #2108), and Word's Options panes (#492). Port regressions in File › Options and the File menu (#7987, #8018, #8022). |
| Right-to-left and complex scripts | 1 | 58% | 50% | 15–25 | UAX #9, Arabic shaping, RTL paragraphs (#207). No kashida justification; open bug reports (#215, #211, #199, #66, #63, #48, #19) need re-testing against #207. **2026-11-28:** Up: RTL tables and sections (#362), letters join across formatting (#4093), Hebrew and Arabic copy from PDF as words (#1383), Arabic interface mirrored. Kashida still missing; #199 and #66 open; screen readers get wrong RTL positions since the port (#7823). |
| East Asian typography | 1 | 35% | 25% | 13–22 | IME input works (winit fixes pending, #155–#164). Vertical text in sections, text boxes and cells with upright ideographs (#491; no `vert` glyph alternates). Ruby/Phonetic Guide with DOCX round trip (#288); document grid (lines per page, characters per line, #391). Two lines in one and horizontal in vertical (`w:eastAsianLayout`) are kept on save but not laid out. No enclose characters, Asian line-break options. **2026-11-28:** Up: Asian Typography tab (#323), automatic Asian/Latin spacing laid out (#2358), Enclose Characters (#297). |
| Accessibility | 1 | 45% | 50% | 10–18 | AccessKit enabled in eframe. Alt Text pane for pictures, shapes, text boxes, groups, charts and tables with Mark as decorative, all round-tripping in DOCX (#386). The Accessibility pane groups errors, warnings and tips with jump-to and one-click fixes; rules for alt text, heading order, header rows, blank table rows/columns, merged cells, low contrast (WCAG ratio), floating objects and blank paragraphs. Screen-reader access to the document canvas is still untested (#18); no reading-order tools. The document canvas describes its text, headings, lists, tables, links, pictures and caret to screen readers through AccessKit (#488); Windows Magnifier follows the caret, onto a new line too (#1119). **2026-11-28:** Down: since the port, screen readers get wrong positions for right-to-left and vertical text (#7823, P0); a macOS accessibility client can freeze the UI (#6893). |
| Agent control (CLI, MCP, control channel, macro record/playback) | 0 | beyond Word | 100%+ | — | Every action is a command id usable from CLI, MCP and a keyed control port. Word has VBA and Office.js instead (see Ecosystem). |
Weighted feature depth: **~68%** (Σ weight × parity / 100 over the table).
Weighted feature depth: **~71%** (was ~68%; Σ weight × parity / 100 over the table): (12·85 + 11·84 + 8·77 + 6·78 + 8·78 + 7·74 + 5·74 + 3·60 + 5·65 + 8·72 + 5·52 + 2·70 + 6·64 + 1·78 + 4·30 + 3·70 + 3·64 + 1·58 + 1·35 + 1·45) / 100 = 71.4. The Mailings and Pictures rows were listed twice; the older copy of each was removed. Neither sum counted the copies.
## Readiness numbers: full, mainstream practitioner, essentials user
@@ -93,33 +93,38 @@ what still stops real work. The stage follows the full number and the core-workf
| Audience | Ready | Opus 5.5 agent wall-clock hours to ~95% | Work that dominates |
|---|---|---|---|
| Full target (ready for real work) | **~60%** | **~650–1,100 h** (70–80% parallelizes) | Breadth: charts/SmartArt/Draw, localization and proofing languages, East Asian and RTL typography, `.doc` writing, PDF Reflow, ecosystem; plus everything below |
| Mainstream practitioner | **~55%** | **~300–500 h** (~65% parallelizes) | DOCX real-world fidelity and preserving charts/SmartArt, pagination fidelity, formatting revisions, dialog depth, objects, stability |
| Essentials user | **~63%** | **~90–140 h** (~50% parallelizes) | Install/launch stability, opening files people send (corpus subset, chart fallbacks), native printing, picture handling, English spelling depth |
| Full target (ready for real work) | **~63%** (was ~60%) | **~675–1,150 h** (70–80% parallelizes) | Breadth: charts/SmartArt/Draw, localization and proofing languages, East Asian and RTL typography, `.doc` writing, PDF Reflow, ecosystem; plus everything below |
| Mainstream practitioner | **~56%** (was ~55%) | **~325–550 h** (~65% parallelizes) | Finishing #7671 (multi-window data loss #7822 first), DOCX real-world fidelity and preserving charts/SmartArt, pagination fidelity, formatting revisions, dialog depth, objects, stability |
| Essentials user | **~62%** (was ~63%) | **~105–165 h** (~50% parallelizes) | The #7671 regressions an essentials user meets (#7822, idle CPU #7674, dialog labels #7976), install/launch stability, opening files people send (corpus subset, chart fallbacks), native printing, picture handling, English spelling depth |
Hours are calibrated as in [Calibration](#calibration-of-hours-from-this-repos-history) and are
subsets: essentials ⊂ mainstream ⊂ full. Mainstream to ~95%: its areas' depth (~180–280 h) plus
the file-exchange, stability and interaction work behind the discounts (~135–225 h). Essentials to
~95%: launch/install stability (15–25 h), opening received files (30–50 h), native printing (6–10
h), pictures and tables (12–18 h), spelling depth (8–12 h), polish (10–20 h).
2026-11-28: each audience's hours are the 2026-10-10 hours plus the #7671 work it meets (full and
mainstream ~25–45 h, essentials ~15–25 h). The areas were not re-priced one by one, so work done
since 2026-10-10 (native printing, column balancing) is not yet taken off.
### The discounts (evidence)
| Discount | Mainstream | Essentials | Evidence |
|---|---|---|---|
| Interaction fidelity | ×0.93 | — | Typing pinned to Word (`tests/typing.rs`), ribbon, keytips, mini-toolbar; but 16 modal dialogs against Word's ~100, 125 of ~250 shortcuts, picture/shape handling complaints (#82, #142), lines wrap differently without an Aptos-metric font |
| Discoverability and UI clarity | — | ×0.95 | Word-style ribbon a Word user already knows, command search, keytips; some newer pane strings and tooltips terse or untranslated |
| Stability on real machines | ×0.90 | ×0.90 (launch and install) | Never-crash standard, hostile-param fuzzing, panic guard; but open startup crash on Intel UHD (#170), freezes (#77, #59, #31), Windows writes fail without admin (#218), installer conflicts with other Crafting Apps (#64, #73, #106, #51); 5 days of field history |
| Exchanging files with Word users | ×0.90 | ×0.92 (opening files people send) | Word opens our .docx; `.doc` import; but no real-world corpus test, charts/SmartArt/OLE dropped silently, pagination differs (Aptos, no column balancing or footnote continuation). Simple documents, which are most of what a casual user receives, come through well; double-click open on macOS is fixed on main but not yet released (#223, #279) |
| Product | **×0.753** | **×0.787** | |
| Interaction fidelity | ×0.93 | — | Typing pinned to Word (`tests/typing.rs`), ribbon, keytips, mini-toolbar; about 100 dialog names (`dialogs::route`, was 16 modal dialogs), 140 (macOS) / 158 (Linux, Windows) of Word's ~250 shortcuts ([gaps.md](gaps.md) #24), picture and shape complaints closed (#82, #142). Held at ×0.93, not raised, because of port regressions: caret moves stop at 255-character runs (#7826), Customize Keyboard can't assign a shortcut (#7971), dialog labels missing or clipped (#7976, #7982) |
| Discoverability and UI clarity | — | ×0.93 (was ×0.95) | Word-style ribbon a Word user already knows, command search, keytips; but since the port the View tab lost group labels (#7985), command search lost locations and shortcuts (#7983), disabled buttons are unreadable (#7978) and disabled-reason tooltips are gone (#7824) |
| Stability on real machines | ×0.87 (was ×0.90) | ×0.90 (launch and install) | Never-crash standard, hostile-param fuzzing, panic guard; old freezes and install conflicts closed (#77, #59, #31, #218, #64, #73, #106, #51). But the port added multi-window data loss (#7822, P0) and ~85% idle CPU (#7674); open: closing or crashing with a second document (#5809, #5563), Windows freezes (#6104, #5801), GPU-reset panic (#7187), startup failures (#170, #6031, #5363, #7096) and data-loss bugs (#7045, #7069, #5548). Launch and install held: old failures closed, new ones opened |
| Exchanging files with Word users | ×0.92 (was ×0.90) | ×0.92 (opening files people send) | Word opens our .docx; `.doc` import; charts, SmartArt and OLE now kept on save (#319), encrypted files open (#55), double-click open on macOS released (#223). Still no real-world corpus test; DOCX drops modern charts with a text fallback (#7238); legacy `.doc` import loses table merges, padding and alignment (#7300–#7306), which holds essentials at ×0.92 |
| Product | **×0.744** (0.93 × 0.87 × 0.92; was ×0.753) | **×0.770** (0.93 × 0.90 × 0.92; was ×0.787) | |
### Full target (ready for real work): ~60%
### Full target (ready for real work): ~63%
The additive weighted sum over the [dimension table](#by-dimension): **0.30·68 + 0.20·60 + 0.15·55 +
0.10·65 + 0.10·50 + 0.05·75 + 0.04·25 + 0.03·95 + 0.01·40 + 0.02·15 ≈ 60%** (range 55–63%). No
The additive weighted sum over the [dimension table](#by-dimension): **0.30·71 + 0.20·65 + 0.15·60 +
0.10·62 + 0.10·45 + 0.05·70 + 0.04·45 + 0.03·95 + 0.01·45 + 0.02·15 = 62.9 ≈ 63%** (range 58–66%).
Was 0.30·68 + 0.20·60 + 0.15·55 + 0.10·65 + 0.10·50 + 0.05·75 + 0.04·27 + 0.03·95 + 0.01·40 +
0.02·15 = 60.5 (the old formula wrote 25 for Localization; the table said 27). No
multiplicative discounts: stability, file formats, layout and UI are weighted dimensions here.
### Mainstream practitioner: ~55%
### Mainstream practitioner: ~56%
The typical professional Word user (office, legal, academic, writing) in their own language, weekly
work only. Left out: equations, mail merge, Draw/ink, East Asian and right-to-left typography,
@@ -129,24 +134,24 @@ dictation and pens.
| Area | Weight | Depth |
|---|---|---|
| Typing, selection, clipboard, undo, find/replace | 17 | 85% |
| Character and paragraph formatting | 16 | 82% |
| Styles | 9 | 74% |
| Tables | 9 | 76% |
| Character and paragraph formatting | 16 | 84% (was 82%) |
| Styles | 9 | 77% (was 74%) |
| Tables | 9 | 78% (was 76%) |
| Review (comments, track changes) | 9 | 72% |
| Lists | 8 | 78% |
| Page layout and sections | 6 | 70% |
| Headers, footers, page numbers, fields | 5 | 70% |
| Proofing in the user's language (English) | 5 | 55% |
| Pictures, shapes, text boxes | 5 | 60% |
| Page layout and sections | 6 | 74% (was 70%) |
| Headers, footers, page numbers, fields | 5 | 74% (was 70%) |
| Proofing in the user's language (English) | 5 | 60% (was 55%) |
| Pictures, shapes, text boxes | 5 | 64% (was 60%) |
| References (TOC, captions, citations) | 4 | 65% |
| Footnotes | 2 | 60% |
| Charts and SmartArt (pasted from Excel or received) | 2 | 3% |
| Print and PDF | 2 | 65% |
| View | 1 | 72% |
| Charts and SmartArt (pasted from Excel or received) | 2 | 25% (was 3%) |
| Print and PDF | 2 | 72% (was 65%) |
| View | 1 | 70% (was 72%) |
Base ≈ **73%**; **73% × 0.753 ≈ 55%**.
Base ≈ **75%** (75.3; was 73.1); **75.3% × 0.744 = 56.0 ≈ 56%**. English proofing: American, British and Canadian spelling each against its own word list ([gaps.md](gaps.md) #8). Received charts are drawn and kept (#292, #319) but read-only. Print and PDF: native printing (#783, #641).
### Essentials user: ~63%
### Essentials user: ~62%
Someone who uses only the core of Word: create or open a document, type and format it, a list, a
picture, a simple table, spelling, undo, save, PDF or print, default settings. Advanced options,
@@ -157,18 +162,18 @@ mainstream.
|---|---|---|
| Typing, selection, copy/paste, undo | 20 | 85% |
| Font, size, bold/italic/underline, colour, highlight | 15 | 88% |
| New, open, save, AutoSave, templates | 12 | 80% |
| New, open, save, AutoSave, templates | 12 | 78% (was 80%) |
| Alignment, line spacing, indents | 8 | 85% |
| Bullets and numbering | 8 | 85% |
| Spelling (English) | 8 | 65% |
| Insert, move and resize a picture | 7 | 65% |
| Simple table | 6 | 78% |
| Spelling (English) | 8 | 68% (was 65%) |
| Insert, move and resize a picture | 7 | 68% (was 65%) |
| Simple table | 6 | 80% (was 78%) |
| Heading styles from the gallery | 5 | 78% |
| Print and export PDF | 5 | 70% |
| Print and export PDF | 5 | 78% (was 70%) |
| Find and replace | 3 | 85% |
| Page numbers and a simple header | 3 | 75% |
Base ≈ **80%**; **80% × 0.787 ≈ 63%**.
Base ≈ **81%** (80.8; was 80.0); **80.8% × 0.770 = 62.2 ≈ 62%**. Open and save down for multi-window data loss (#7822) and recent documents that don't open on Linux (#7322); pictures up as #82 and #142 closed; print up for native printing (#783).
### User evidence (GitHub, 2026-10-10; no issue was filed by a storytold org member)
@@ -189,22 +194,22 @@ Base ≈ **80%**; **80% × 0.787 ≈ 63%**.
Weights are our estimate of how much each dimension decides whether a professional can switch from
Word. Their weighted sum is the **full ready for real work** number.
| Dimension | Weight | Parity | Hours to full | Doc | Evidence |
|---|---|---|---|---|---|
| Features (depth, table above) | 30% | 68% | 210–335 | this file | Weighted table above. Hours: the area table sums to 290–460 h; the Page layout, Footnotes, RTL and East Asian rows (~50–85 h) are counted under Layout and the Proofing row (25–45 h) under Localization, so they aren't counted twice |
| File formats (DOCX fidelity first) | 20% | 60% | 185–300 | [file-format-parity.md](file-format-parity.md) | DOCX opens in Word and round-trips our own tests, but no real-world corpus test yet; charts, SmartArt, OLE and encrypted files are lost or refused (content controls kept since #381) |
| Layout and pagination fidelity | 15% | 55% | 90–145 | [layout-parity.md](layout-parity.md) | Aptos has no metric-matched substitute so lines break differently from Word; no column balancing, footnote continuation or document grid; compatibility modes beyond 15 partial |
| UI/UX fidelity | 10% | 65% | 65–100 | [ui-parity.md](ui-parity.md) | Ribbon, keytips, mini-toolbar, Backstage, 125 shortcuts; 16 modal dialogs against Word's ~100; no ribbon/keyboard customization |
| Stability | 10% | 50% | 25–45 | [gaps.md](gaps.md) | Never-crash standard and hostile-param fuzzing in place, but open reports of a startup crash on Intel UHD (#170), freezes (#77, #59, #31) and Windows write failure without admin (#218); local desktop recovery with focused lifecycle tests, but no longer soak test; 5 days of field history |
| Performance | 5% | 75% | 10–20 | [layout-parity.md](layout-parity.md) | 61 ms cold layout and 1.4 ms relayout on a 188-page document (measured 2026-10-06, not re-run); font picker freezes fixed in #233; typing no longer starts and stops render threads on every repaint (#3027); no large real-world documents measured |
| Localization | 4% | 27% | 75–120 + native review | [localization-parity.md](localization-parity.md) | 13 UI languages (Word 30); 4 of the 12 key languages partly done; English and Polish proofing |
| Platforms | 3% | 95% | 5–10 | [ROADMAP.md](../ROADMAP.md) | macOS (universal, signed), Windows x64/x86/arm64, Linux (AppImage/deb/rpm/Flatpak), FreeBSD, web. Beyond Word on Linux, BSD and the web; Word's iPad/iPhone/Android apps are out of scope |
| Hardware | 1% | 40% | 20–40 | [hardware-parity.md](hardware-parity.md) | No native printing on desktop, no pen/ink, no dictation; GPU drawing and HiDPI fine. Ink hours are in the Features row (Draw tab) |
| Ecosystem and plugins | 2% | 15% | 40–80 | [gaps.md](gaps.md) | Zotero built in, macros record/play commands, `.docm` macros preserved (#172). No VBA execution, no Office add-ins, no EndNote/Mendeley plugins, no cloud storage or co-authoring |
| AI features | 0% | 40% | 15–30 | [gaps.md](gaps.md) | Beyond Word for external agents (MCP, CLI). No in-app writing assistant like Copilot yet (chat PR #178 open). Weight 0: Copilot is a paid add-on and not what decides a switch |
| Dimension | Weight | Parity | Was (2026-10-10) | Hours to full | Doc | Evidence |
|---|---|---|---|---|---|---|
| Features (depth, table above) | 30% | 71% | 68% | 200–325 (was written 210–335; corrected from the rows) | this file | Weighted table above. Up: Field dialog, column balancing, Group, contour wrap, native printing, 10 proofing languages, Insert › Chart and SmartArt re-scored (#349, #353, #267, #354, #783, #409, #497); down for port regressions in View, Accessibility and Equation galleries (#7985, #7823, #7975). Hours: the area table sums to 265–435 h; the Page layout, Footnotes, RTL and East Asian rows (43–72 h) are counted under Layout and the Proofing row (20–40 h) under Localization, so they aren't counted twice |
| File formats (DOCX fidelity first) | 20% | 65% | 60% | 185–300 | [file-format-parity.md](file-format-parity.md) | Up: charts, SmartArt and OLE kept on save (#319), encrypted packages open and save (#55, #281), Word 2003 XML opens and saves (#548, #1081), content controls kept (#381), a structural `.docx` checker (#5875). Still no real-world corpus test (gap #1); open critical file bugs: modern charts dropped with a text fallback (#7238), Word 2010 number formats lost (#5318), Compare drops the comments part (#6273); legacy `.doc` table import losses (#7300–#7306) |
| Layout and pagination fidelity | 15% | 60% | 55% | 90–145 | [layout-parity.md](layout-parity.md) | Up: all three missing items named here landed: column balancing (#353, #6821), footnote continuation (#352) and the document grid (#391); RTL sections (#362). Still: Aptos has no metric-matched substitute, so lines break differently from Word; no page-by-page comparison with Word; compatibility modes beyond 15 partial ([gaps.md](gaps.md) #4) |
| UI/UX fidelity | 10% | 62% | 65% | 65–100 + #7671 | [ui-parity.md](ui-parity.md) | Before the port it rose: about 100 dialog names (was 16), 140/158 shortcuts (was 125), Customize Keyboard and Customize Ribbon/Quick Access (#368, #379). The port took more back: 45 of #7671's 59 sub-issues are open, among them Customize Keyboard can't assign a shortcut (#7971), dialog labels missing or text clipped (#7976, #7982), previews shrunk (#7977), unreadable disabled buttons (#7978) and the ribbon 12 px short (#7680); #8025 and #8031 fixed #7988 and #7970 |
| Stability | 10% | 45% | 50% | 25–45 + #7671 P0s | [gaps.md](gaps.md) | Down: the port added multi-window data loss (#7822, P0). Open: closing or crashing with a second document (#5809, #5563), Windows freezes (#6104, #5801), a GPU-reset panic (#7187), startup failures (#170, #6031, #5363, #7096), data-loss bugs (#7045, #7069, #5548); 47 open issues marked critical. Old freezes and the no-admin write failure are closed (#77, #59, #31, #218). Seven weeks of field history now, not 5 days |
| Performance | 5% | 70% | 75% | 10–20 | [layout-parity.md](layout-parity.md) | Down: since the port the app uses ~85% CPU while idle (#7674; #7719 merged, #7881, #7882, #7912, #7913 in review); starting a new document lagged 20+ s in v0.18.1 (#7688). 61 ms cold layout and 1.4 ms relayout on a 188-page document (measured 2026-10-06, not re-run: no bench for it); scrolling a 1,096-page one-table document ~2–5 ms a frame (#811); no large real-world documents measured |
| Localization | 4% | 45% | 27% | 75–120 + native review | [localization-parity.md](localization-parity.md) | Up. Measured at the `craft-i18n.rev` pin (`e56d262`): 36 locales have a non-empty `wordcraft.tsv`, and 28 of them are in the app's language list (English makes 29; Word has 30; was 13). `cargo xtask i18n-report`'s check, run on this branch, finds 510–595 strings missing in 19 of them and 841–934 in nine (de, et, ja, pt-br, sr, sr-latn, uk, zh-hans, zh-hant). Set against each catalog's translated rows, that is ~80–84% and ~70–73% complete; that's an upper bound, as some rows may be stale. The report prints no English total. No catalog has had a native-speaker review. Proofing: 10 built-in languages against Word's ~50 ([gaps.md](gaps.md) #8). The 8 other catalogs (bn, fa, he, id, ka, lv, nb, sk) aren't offered yet |
| Platforms | 3% | 95% | 95% | 5–10 | [ROADMAP.md](../ROADMAP.md) | No change: macOS (universal, signed), Windows x64/x86/arm64, Linux (AppImage/deb/rpm/Flatpak), FreeBSD, web. Launch failures on single setups (Raspberry Pi OS #7096, Windows without `Windows.Data.Pdf.dll` #6031) are counted under Stability. Word's iPad/iPhone/Android apps are out of scope |
| Hardware | 1% | 45% | 40% | 20–40 | [hardware-parity.md](hardware-parity.md) | Up: native printing on desktop through craft-print with printer choice, copies, duplex, N-up, booklets and scale to paper (#783, #641, #2108); Linux Read Aloud through espeak-ng or Speech Dispatcher. No pen pressure, no dictation; GPU drawing and HiDPI fine. Ink hours are in the Features row (Draw tab) |
| Ecosystem and plugins | 2% | 15% | 15% | 40–80 | [gaps.md](gaps.md) | No change: Zotero built in, macros record/play commands, `.docm` macros preserved (#172), Templates and Add-ins dialog with Organizer (#382). No VBA execution, no Office add-ins, no EndNote/Mendeley plugins, no cloud storage (WebDAV in progress, #4877) or co-authoring |
| AI features | 0% | 40% | 40% | 15–30 | [gaps.md](gaps.md) | No change: beyond Word for external agents (MCP, CLI). No in-app writing assistant; the chat and assistant PRs closed unmerged (#178, #815). Weight 0: Copilot is a paid add-on and not what decides a switch |
**Ready for real work ≈ 0.30·68 + 0.20·60 + 0.15·55 + 0.10·65 + 0.10·50 + 0.05·75 + 0.04·25 +
0.03·95 + 0.01·40 + 0.02·15 ≈ 60%.**
**Ready for real work = 0.30·71 + 0.20·65 + 0.15·60 + 0.10·62 + 0.10·45 + 0.05·70 + 0.04·45 +
0.03·95 + 0.01·45 + 0.02·15 = 62.9 ≈ 63%** (was 60.5 ≈ 60%).
## Methodology
@@ -223,6 +228,12 @@ Word. Their weighted sum is the **full ready for real work** number.
priced DOCX corpus fidelity at 10 h. The new evidence is the Word bundle inventory (30 UI
languages, 120 proofing tools, 12 bibliography styles), the 62 open issues as of 2026-10-10 (crashes, freezes,
RTL reports) and the size of comparable work actually done (below).
- **2026-11-28 re-measure** (main `6fbf780789`, after the craft-ui port): each area and dimension
was re-scored from the 1,863 PRs merged since 2026-10-10, the open bugs (814 labelled `bug`, 47
marked critical), the companion docs (each last reviewed 2026-10-10 to 2026-10-12, with small
updates through November) and epic #7671. A number moved only where landed work or an open
regression supports it. The interface catalogs were counted at the `craft-i18n.rev` pin, and the missing-translation
report was run once (see the Localization row). The app was not run, and nothing was compared with Word page by page.
### Calibration of hours (from this repo's history)
@@ -325,3 +336,5 @@ can be used without committing Word output.
| 2026-10-06 | major | First estimate in ROADMAP.md: ~62% real feature parity, 120–150 h to 100% |
| 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. |
| 2026-11-28 | minor | Re-measured against main `6fbf780789` after the craft-ui port (#7101, #7671). Full ~60% → ~63%, mainstream ~55% → ~56%, essentials ~63% → ~62%, feature depth ~68% → ~71%, breadth ~80% → ~85%. Dimensions: Features 68 → 71, File formats 60 → 65, Layout 55 → 60, UI/UX 65 → 62, Stability 50 → 45, Performance 75 → 70, Localization 27 → 45, Hardware 40 → 45; Platforms, Ecosystem and AI unchanged. Beta ~150–230 h → ~175–275 h, full parity ~750–1,250 h → ~775–1,300 h (#7671 work added; areas not re-priced). Duplicate Mailings and Pictures rows removed; superseded "missing" notes dropped; Features hours corrected to the rows, 200–325 h |
+4 -4
View File
@@ -189,7 +189,7 @@ def reviewed_manual_actors(caller_source, policy):
def caller_pin(name):
return re.findall(r"(?m)^ tooling-revision: (\S+)$", (ROOT / ".github/workflows" / name).read_text())[0]
return re.findall(r"(?m)^ tooling-revision: ([0-9a-f]{40})$", (ROOT / ".github/workflows" / name).read_text())[0]
class TrustedSourcePreparation(unittest.TestCase):
@@ -354,7 +354,7 @@ class NightlyTrustAnchors(unittest.TestCase):
self.assertEqual(tooling, uses, "the defining workflow SHA and tooling input must match")
pins.update(uses)
self.assertEqual(len(pins), 1, "producer and signer must pin the same shared commit")
self.assertEqual(pins.pop(), "main", "pin storytold/craft-common-actions to @main")
self.assertRegex(pins.pop(), r"^[0-9a-f]{40}$", "pin a full immutable commit, never a branch or placeholder")
class NightlyEnabledCallers(unittest.TestCase):
@@ -737,7 +737,7 @@ def trust_closure_problems(workflows):
if workflow.lower() in ("nightly-release.yml", "nightly-release.yaml"):
if name == "nightly-sign.yml":
signer_calls += 1
if name != "nightly-sign.yml" or ref != "main":
if name != "nightly-sign.yml" or not re.fullmatch(r"[0-9a-f]{40}", ref):
problems.append(name + " calls nightly-release.yml@" + ref)
if workflow.lower() in ("release.yml", "release.yaml"):
stable_callers.add(name)
@@ -784,7 +784,7 @@ class NightlySignerBranchTrustClosure(unittest.TestCase):
"environment in any flow mapping": {**tree, "extra.yml": "jobs:\n x:\n runs-on: ubuntu-latest\n with: {environment: release}\n"},
"uses in any flow mapping": {**tree, "extra.yml": "jobs:\n x:\n steps:\n - {uses: actions/checkout@v4}\n"},
"another caller of the signer": {**tree, "extra.yml": "jobs:\n x:\n uses: " + SHARED + "nightly-release.yml@" + "a" * 40 + "\n"},
"a signer caller on a non-main branch or tag ref": {**tree, "nightly-sign.yml": tree["nightly-sign.yml"].replace("nightly-release.yml@main", "nightly-release.yml@v1")},
"a mutable signer pin": {**tree, "nightly-sign.yml": re.sub(r"nightly-release\.yml@[0-9a-f]{40}", "nightly-release.yml@main", tree["nightly-sign.yml"])},
"a new stable release caller": {**tree, "extra.yml": "jobs:\n x:\n uses: " + SHARED + "release.yml@main\n"},
"a stable caller on a branch or tag ref": {**tree, "release.yml": tree["release.yml"].replace(SHARED + "release.yml@main", SHARED + "release.yml@v1")},
}