From 767221ca069405fc24d87fde86909ff986aaedeb Mon Sep 17 00:00:00 2001 From: tydude001 Date: Wed, 14 Oct 2026 12:15:46 -0500 Subject: [PATCH 001/716] packaging: RPM requires library sonames, so openSUSE can install it DeckCraft's RPM requires Fedora package names: `libxkbcommon`, `(vulkan-loader or libglvnd-egl)`, `alsa-lib`. openSUSE has no `libxkbcommon`, `vulkan-loader` or `libglvnd-egl` package, so zypper refuses it with `nothing provides 'libxkbcommon'` (exit 4, which the ArtCraft Launcher shows as "error 4"; storytold/craft-launcher#341). Co-Authored-By: Claude Opus 5.5 --- packaging/linux/nfpm.yaml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packaging/linux/nfpm.yaml b/packaging/linux/nfpm.yaml index 0d41fc7ec..0f1111b45 100644 --- a/packaging/linux/nfpm.yaml +++ b/packaging/linux/nfpm.yaml @@ -44,10 +44,17 @@ overrides: - mesa-vulkan-drivers - xdg-desktop-portal rpm: + # Library sonames rather than package names, so the same requirements resolve on Fedora/RHEL + # and openSUSE (which has no libxkbcommon, vulkan-loader or libglvnd-egl package). The glibc + # floor names libm because the binaries' GLIBC_2.35 symbols (hypot, hypotf) are libm's: RHEL 9's + # glibc 2.34 provides libc.so.6(GLIBC_2.35) through backports, but not this, so it refuses. depends: - - libxkbcommon - - alsa-lib - - (vulkan-loader or libglvnd-egl) + - libc.so.6()(64bit) + - libm.so.6(GLIBC_2.35)(64bit) + - libgcc_s.so.1()(64bit) + - libxkbcommon.so.0()(64bit) + - (libvulkan.so.1()(64bit) or libEGL.so.1()(64bit)) + - libasound.so.2()(64bit) recommends: - libwayland-client - libX11 From cc6773c95f1f23800c82329ec404f68868c8b22b Mon Sep 17 00:00:00 2001 From: MarekSpodBiedry <73122968+MarekSpodBiedry@users.noreply.github.com> Date: Thu, 22 Oct 2026 21:02:59 +0200 Subject: [PATCH 002/716] Use evaluated field values in the placed text so the PDF text layer shows the slide number (#1153) --- crates/render/src/placed.rs | 21 ++++++++++++++++++--- crates/render/src/tests.rs | 12 ++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/crates/render/src/placed.rs b/crates/render/src/placed.rs index 0164f3f07..f83af46d8 100644 --- a/crates/render/src/placed.rs +++ b/crates/render/src/placed.rs @@ -2,9 +2,9 @@ //! that put real text over a raster (PDF text layer, links) and for text extraction. use deckcraft_model::resolve::{self, Ctx}; -use deckcraft_model::text::{Hyperlink, TextBody}; +use deckcraft_model::text::{Hyperlink, RunKind, TextBody}; use deckcraft_model::{Presentation, Shape, ShapeId, ShapeKind}; -use deckcraft_text::{Opts, TextLayout}; +use deckcraft_text::{Fields, Opts, TextLayout}; use kurbo::{Affine, Rect}; use crate::{SlideFields, shape_geometry, table}; @@ -162,7 +162,22 @@ fn place_text(out: &mut Placed, rctx: &Ctx, fields: &SlideFields, owner: ShapeId let r = Rect::new(x0, line.top, x1, line.bottom); out.links.push(PlacedLink { rect: m.transform_rect_bbox(r), link, shape: owner, text: true }); } - out.texts.push(PlacedText { layout, transform: m, body: body.clone() }); + // Field runs carry their saved text (`‹#›`); the layout drew their values, so the body that + // goes with it (character offsets, text layer) must hold the same values. + let mut body = body.clone(); + for para in &mut body.paragraphs { + let src = para.clone(); + for run in &mut para.runs { + if let RunKind::Field { field } = &run.kind { + let lang = resolve::run(rctx, s, &src, &run.props).lang; + if let Some(v) = fields.field_in(field, lang.as_deref()) { + run.text = v; + run.kind = RunKind::Text; + } + } + } + } + out.texts.push(PlacedText { layout, transform: m, body }); } /// The hyperlink of the model run containing character `at` of paragraph `para`. diff --git a/crates/render/src/tests.rs b/crates/render/src/tests.rs index 4ee1c889d..9987bd7c9 100644 --- a/crates/render/src/tests.rs +++ b/crates/render/src/tests.rs @@ -2595,3 +2595,15 @@ fn empty_bullet_is_gray_only_while_editing_and_never_in_exports() { assert!(changed.iter().any(|(px, _)| px[0] == 179 && px[1] == 179 && px[2] == 179)); assert!(changed.iter().all(|(px, _)| px[0] >= 179 && px[0] == px[1] && px[1] == px[2])); } + +#[test] +fn placed_text_holds_the_field_value_not_the_saved_placeholder() { + let mut p = deck_with(vec![field_shape(Some("slidenum"), "<#>")]); + let second = p.slides[0].clone(); + p.slides.push(second); + let placed = place_slide(&p, 1); + assert_eq!(placed.texts.len(), 1); + assert_eq!(placed.texts[0].body.text(), "2"); + // The layout was drawn from the same value, so the offsets agree with the body. + assert_eq!(placed.texts[0].layout.runs.iter().map(|r| r.chars.1).max(), Some(1)); +} From 813378cc20aa0d94228bb3f700645e7d546b795d Mon Sep 17 00:00:00 2001 From: MarekSpodBiedry <73122968+MarekSpodBiedry@users.noreply.github.com> Date: Fri, 23 Oct 2026 16:08:53 +0200 Subject: [PATCH 003/716] Keep the PDF text layer aligned with line breaks, use one clock reading for raster and text layer, and test the page text (#1153) --- crates/pdf/src/lib.rs | 9 +++--- crates/pdf/src/tests.rs | 61 ++++++++++++++++++++++++++++++++++--- crates/render/src/lib.rs | 2 +- crates/render/src/placed.rs | 30 ++++++++++-------- crates/render/src/tests.rs | 9 ++++++ 5 files changed, 89 insertions(+), 22 deletions(-) diff --git a/crates/pdf/src/lib.rs b/crates/pdf/src/lib.rs index 22dc42d36..cc5d5e56a 100644 --- a/crates/pdf/src/lib.rs +++ b/crates/pdf/src/lib.rs @@ -299,7 +299,7 @@ pub fn master_text_pieces(pres: &Presentation, m: &deckcraft_model::Master, pape .body .paragraphs .get(run.para) - .map(|p| p.runs.iter().map(|r| r.text.as_str()).collect::()) + .map(|p| p.runs.iter().map(|r| r.content()).collect::()) .unwrap_or_default() .chars() .skip(run.chars.0) @@ -440,7 +440,8 @@ impl Exporter<'_> { let k = b.width() / sw; // Raster at the requested dpi relative to the box size on paper. let scale = (b.width() / 72.0 * self.opts.dpi.clamp(36.0, 600.0)) / sw; - let ropts = RenderOpts { scale, threads: 4, ..Default::default() }; + // One clock reading for the raster and the text layer, so a date field cannot differ between them. + let ropts = RenderOpts { scale, threads: 4, now: deckcraft_text::datetime::DateTime::now_local(), ..Default::default() }; // Two rasters per slide: the backdrop (background, master and layout graphics) is the same // on every slide that shares its layout, so the writer stores it once, and the slide's own // shapes draw over it (#845). @@ -476,7 +477,7 @@ impl Exporter<'_> { } if self.opts.text_layer { let view = Affine::translate((b.x0, b.y0)) * Affine::scale(k); - for pt in deckcraft_render::place_slide(pres, i).texts { + for pt in deckcraft_render::place_slide_with(pres, i, &ropts).texts { self.text_layer(s, &pt, view, false)?; } let _ = sh; @@ -494,7 +495,7 @@ impl Exporter<'_> { .body .paragraphs .get(run.para) - .map(|p| p.runs.iter().map(|r| r.text.as_str()).collect::()) + .map(|p| p.runs.iter().map(|r| r.content()).collect::()) .unwrap_or_default() .chars() .skip(run.chars.0) diff --git a/crates/pdf/src/tests.rs b/crates/pdf/src/tests.rs index 2bc5c41ac..fd1839377 100644 --- a/crates/pdf/src/tests.rs +++ b/crates/pdf/src/tests.rs @@ -200,8 +200,6 @@ fn unembeddable_font_returns_error_instead_of_a_pdf_missing_text() { #[cfg_attr(not(target_arch = "wasm32"), test)] fn supported_unicode_is_shaped_and_recovered_from_the_page_text_layer() { use deckcraft_model::{Shape, ShapeId, Xfrm}; - use hayro_syntax::content::ops::TypedInstruction; - use hayro_syntax::object::{Dict, Object, Stream}; let text = "Café Ελληνικά Привет"; let face = FontDb::global().face("Ubuntu", "Regular"); @@ -223,8 +221,17 @@ fn supported_unicode_is_shaped_and_recovered_from_the_page_text_layer() { assert!(runs.iter().all(|run| run.face.family == "Ubuntu" && !run.glyphs.is_empty() && run.glyphs.iter().all(|glyph| glyph.0 != 0))); let bytes = export(&p, &opts(PageLayout::Slides)).unwrap(); - let pdf = hayro_syntax::Pdf::new(bytes.clone()).unwrap(); - let page = &pdf.pages()[0]; + assert_eq!(page_text(&bytes, 0), text); +} + +/// The text of page `index`, read the way a PDF reader does: the content stream's text-showing +/// operators decoded through the page font's ToUnicode map. +fn page_text(bytes: &[u8], index: usize) -> String { + use hayro_syntax::content::ops::TypedInstruction; + use hayro_syntax::object::{Dict, Object, Stream}; + + let pdf = hayro_syntax::Pdf::new(bytes.to_vec()).unwrap(); + let page = &pdf.pages()[index]; let resources = page.raw().get::>(b"Resources").unwrap(); let fonts = resources.get::>(b"Font").unwrap(); assert_eq!(fonts.len(), 1); @@ -275,7 +282,51 @@ fn supported_unicode_is_shaped_and_recovered_from_the_page_text_layer() { _ => {} } } - assert_eq!(extracted, text); + extracted +} + +fn ubuntu_runs(runs: Vec) -> TextBody { + let paragraph = deckcraft_model::text::Paragraph { runs, ..Default::default() }; + let mut body = TextBody { paragraphs: vec![paragraph], ..Default::default() }; + for run in &mut body.paragraphs[0].runs { + run.props.font = Some("Ubuntu".into()); + run.props.size = Some(20.0); + } + body +} + +fn deck_with_body(n: usize, body: TextBody) -> Presentation { + use deckcraft_model::{Shape, ShapeId, Xfrm}; + let mut p = deck(n); + for slide in &mut p.slides { + Arc::make_mut(slide).shapes = + vec![Shape { id: ShapeId(9001), xfrm: Some(Xfrm::new(20.0, 20.0, 920.0, 100.0)), text: Some(body.clone()), ..Default::default() }]; + } + p +} + +#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)] +#[cfg_attr(not(target_arch = "wasm32"), test)] +fn slide_number_field_is_recovered_from_the_page_text_layer() { + use deckcraft_model::text::{Run, RunKind}; + let mut field = Run::new("<#>"); + field.kind = RunKind::Field { field: "slidenum".into() }; + let p = deck_with_body(3, ubuntu_runs(vec![Run::new("Page "), field])); + let bytes = export(&p, &opts(PageLayout::Slides)).unwrap(); + for (i, want) in ["Page 1", "Page 2", "Page 3"].into_iter().enumerate() { + assert_eq!(page_text(&bytes, i), want); + } +} + +#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)] +#[cfg_attr(not(target_arch = "wasm32"), test)] +fn line_break_keeps_the_text_layer_aligned_with_the_layout() { + use deckcraft_model::text::{Run, RunKind}; + let mut brk = Run::new(""); + brk.kind = RunKind::Break; + let p = deck_with_body(1, ubuntu_runs(vec![Run::new("one"), brk, Run::new("two")])); + let bytes = export(&p, &opts(PageLayout::Slides)).unwrap(); + assert_eq!(page_text(&bytes, 0), "onetwo"); } /// Notes pages and handouts print on the chosen paper, landscape included, with every slide box diff --git a/crates/render/src/lib.rs b/crates/render/src/lib.rs index cf124a9f6..722162721 100644 --- a/crates/render/src/lib.rs +++ b/crates/render/src/lib.rs @@ -53,7 +53,7 @@ pub use extent::{Region, TILE, layout_extent, pasteboard_region, slide_extent}; pub use images::{decode as decode_image, gif_frame}; pub use morph_path::PathMorph; pub use morph_text::TextMorph; -pub use placed::{Placed, PlacedLink, PlacedShape, PlacedText, place_master_texts, place_slide, text_outline}; +pub use placed::{Placed, PlacedLink, PlacedShape, PlacedText, place_master_texts, place_slide, place_slide_with, text_outline}; pub use table::cell_body as table_cell_body; pub use table::cell_rects as table_cell_rects; pub use table::row_heights as table_row_heights; diff --git a/crates/render/src/placed.rs b/crates/render/src/placed.rs index f83af46d8..2081b2400 100644 --- a/crates/render/src/placed.rs +++ b/crates/render/src/placed.rs @@ -52,10 +52,16 @@ pub struct Placed { /// Text and links of slide `index` (master and layout graphics first, as rendered). pub fn place_slide(pres: &Presentation, index: usize) -> Placed { + place_slide_with(pres, index, &crate::RenderOpts::default()) +} + +/// [`place_slide`] with the render options the slide was drawn with, so date fields take the same +/// date and time as the raster (`opts.now`). +pub fn place_slide_with(pres: &Presentation, index: usize, opts: &crate::RenderOpts) -> Placed { let mut out = Placed::default(); let Some(slide) = pres.slides.get(index) else { return out }; let Some(rctx) = Ctx::for_slide(pres, slide) else { return out }; - let fields = SlideFields::new(pres.slide_number(index), pres.header_footer.footer_text.clone(), &crate::RenderOpts::default()); + let fields = SlideFields::new(pres.slide_number(index), pres.header_footer.footer_text.clone(), opts); let (show_layout, show_master) = resolve::show_master_shapes(slide, rctx.layout); if show_master { let mctx = Ctx::for_master(pres, rctx.master); @@ -164,20 +170,20 @@ fn place_text(out: &mut Placed, rctx: &Ctx, fields: &SlideFields, owner: ShapeId } // Field runs carry their saved text (`‹#›`); the layout drew their values, so the body that // goes with it (character offsets, text layer) must hold the same values. - let mut body = body.clone(); - for para in &mut body.paragraphs { - let src = para.clone(); - for run in &mut para.runs { - if let RunKind::Field { field } = &run.kind { - let lang = resolve::run(rctx, s, &src, &run.props).lang; - if let Some(v) = fields.field_in(field, lang.as_deref()) { - run.text = v; - run.kind = RunKind::Text; - } + let mut placed = body.clone(); + for (pi, para) in body.paragraphs.iter().enumerate() { + for (ri, run) in para.runs.iter().enumerate() { + let RunKind::Field { field } = &run.kind else { continue }; + let lang = resolve::run(rctx, s, para, &run.props).lang; + if let Some(v) = fields.field_in(field, lang.as_deref()) + && let Some(out_run) = placed.paragraphs.get_mut(pi).and_then(|p| p.runs.get_mut(ri)) + { + out_run.text = v; + out_run.kind = RunKind::Text; } } } - out.texts.push(PlacedText { layout, transform: m, body }); + out.texts.push(PlacedText { layout, transform: m, body: placed }); } /// The hyperlink of the model run containing character `at` of paragraph `para`. diff --git a/crates/render/src/tests.rs b/crates/render/src/tests.rs index 9987bd7c9..b9011f999 100644 --- a/crates/render/src/tests.rs +++ b/crates/render/src/tests.rs @@ -2607,3 +2607,12 @@ fn placed_text_holds_the_field_value_not_the_saved_placeholder() { // The layout was drawn from the same value, so the offsets agree with the body. assert_eq!(placed.texts[0].layout.runs.iter().map(|r| r.chars.1).max(), Some(1)); } + +#[test] +fn placed_text_takes_its_date_from_the_given_render_options() { + use deckcraft_text::datetime::DateTime; + let p = deck_with(vec![field_shape(Some("datetime1"), "1/1/2000")]); + let at = |now: DateTime| place_slide_with(&p, 0, &RenderOpts { now: Some(now), ..Default::default() }); + assert_eq!(at(DateTime::new(2026, 10, 9, 20, 5, 7)).texts[0].body.text(), "10/9/2026"); + assert_eq!(at(DateTime::new(2027, 3, 4, 0, 0, 0)).texts[0].body.text(), "3/4/2027"); +} From 78ab8f062629894793d9270d7687deb212f89613 Mon Sep 17 00:00:00 2001 From: SusieeTheFemboy <96988330+SusieeTheLinuxUser@users.noreply.github.com> Date: Sat, 24 Oct 2026 00:09:16 +0200 Subject: [PATCH 004/716] H.264: temporal direct mvs are scaled in i32 and clipped to the spec range MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The temporal direct derivation truncated (mvCol · DistScaleFactor + 128) >> 8 with `as i16`, wrapping mvL0 past the spec's motion-vector range on crafted streams, and mvL0 − mvCol then panicked a debug build with "attempt to subtract with overflow". The scale and the subtraction now run in i32 (dsf is already clamped to ±1024, so they cannot overflow) and only the results are clipped to −2^15..2^15−1, as ITU-T H.264 8.4.1.2.4 reads — mvL1 scaled from the unclamped mvL0, the shape review settled for the same decoder code in SoundCraft (soundcraft#994): dsf 512, mvCol 32767 keeps mvL1 at 32767. Extends the grouped robustness audit's codec-overflow list (#1183), which covers the POC/MMCO/latency sites but not this one. Co-Authored-By: GLM-5.3 --- crates/h264/src/slicedec.rs | 52 ++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/crates/h264/src/slicedec.rs b/crates/h264/src/slicedec.rs index 10132d683..fee675a24 100644 --- a/crates/h264/src/slicedec.rs +++ b/crates/h264/src/slicedec.rs @@ -566,6 +566,19 @@ impl<'a> SliceDecoder<'a> { (refs, mvs, false) } + /// Temporal direct mvs (8.4.1.2.4) from the co-located mv and `DistScaleFactor` (clamped + /// to ±1024 in `SliceDecoder`): mvL0 = clip_mv((mvCol · dsf + 128) >> 8), mvL1 = + /// clip_mv(mvL0 − mvCol), both clipped to the spec's motion-vector range −2^15..2^15−1. + /// The i32 maths cannot overflow; a truncating `as i16` used to wrap mvL0 past the range, + /// after which the mvL1 subtraction overflowed a debug build. mvL1 is scaled from the + /// unclamped mvL0 with only the results clipped, as the sibling SoundCraft decoder's + /// review established (soundcraft#994): dsf 512, mvCol 32767 keeps mvL1 at 32767. + fn temporal_direct_mvs(dsf: i32, mv_col: [i16; 2]) -> ([i16; 2], [i16; 2]) { + let clamp = |v: i32| v.clamp(-(1 << 15), (1 << 15) - 1) as i16; + let m0 = mv_col.map(|c| (dsf * i32::from(c) + 128) >> 8); + (m0.map(clamp), [clamp(m0[0] - i32::from(mv_col[0])), clamp(m0[1] - i32::from(mv_col[1]))]) + } + /// Derive direct-mode motion for the 8x8 blocks in `b8_mask` of the current MB. fn derive_direct(&mut self, b8_mask: u8) -> Result<()> { let spatial = self.sh.direct_spatial_mv_pred; @@ -600,13 +613,7 @@ impl<'a> SliceDecoder<'a> { } }; let (dsf, ltr) = self.tdirect.get(ref0 as usize).copied().unwrap_or((256, true)); - let (mv0, mv1) = if ltr { - (mv_col, [0, 0]) - } else { - let s = |c: i16| ((dsf * c as i32 + 128) >> 8) as i16; - let m0 = [s(mv_col[0]), s(mv_col[1])]; - (m0, [m0[0] - mv_col[0], m0[1] - mv_col[1]]) - }; + let (mv0, mv1) = if ltr { (mv_col, [0, 0]) } else { Self::temporal_direct_mvs(dsf, mv_col) }; ([ref0, 0], [mv0, mv1]) }; self.set_motion(x, y, unit, unit, refs, mvs); @@ -1467,3 +1474,34 @@ impl<'a> SliceDecoder<'a> { Ok(()) } } + +#[cfg(test)] +mod tests { + use super::SliceDecoder; + + /// Temporal direct mvs stay inside the spec's motion-vector range −2^15..2^15−1 with a + /// large `DistScaleFactor` and a co-located mv at an i16 extreme: the scale used to + /// truncate past the range with `as i16`, and mvL0 − mvCol then overflowed a debug build + /// ("attempt to subtract with overflow"). `dsf` 256 is the identity scale. + #[test] + fn temporal_direct_mvs_at_i16_extremes_stay_in_the_spec_range() { + for dsf in [-1024i32, -1, 256, 1023] { + for col in [[i16::MIN, i16::MIN], [i16::MAX, i16::MAX], [i16::MIN, i16::MAX]] { + let (mv0, mv1) = SliceDecoder::temporal_direct_mvs(dsf, col); + for mv in [mv0, mv1] { + for c in mv { + assert!((-(1 << 15)..(1 << 15)).contains(&i32::from(c)), "dsf {dsf}, col {col:?}: {mv:?}"); + } + } + if dsf == 256 { + assert_eq!((mv0, mv1), (col, [0, 0]), "dsf 256 is the identity scale"); + } + // soundcraft#994: mvL1 is scaled from the unclamped mvL0 with only the results + // clipped — deriving it from the clipped mvL0 gave [0, 0] here. + if dsf == 512 && col == [i16::MAX, 0] { + assert_eq!((mv0, mv1), ([i16::MAX, 0], [i16::MAX, 0]), "mvL1 keeps mvL0's off-range part"); + } + } + } + } +} From 48c5ff67bf42ce58bf2f6cd9436bb02050b5f8b7 Mon Sep 17 00:00:00 2001 From: SusieeTheFemboy <96988330+SusieeTheLinuxUser@users.noreply.github.com> Date: Sat, 24 Oct 2026 00:40:21 +0200 Subject: [PATCH 005/716] H.264: the temporal-direct test runs the dsf 512 case The dsf 512 / mvCol [32767, 0] check sat inside loops that never produce that pair, so it never ran. It is now a direct assertion after the sweep. Co-Authored-By: Claude Opus 5.5 --- crates/h264/src/slicedec.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/h264/src/slicedec.rs b/crates/h264/src/slicedec.rs index fee675a24..2ada51594 100644 --- a/crates/h264/src/slicedec.rs +++ b/crates/h264/src/slicedec.rs @@ -1496,12 +1496,11 @@ mod tests { if dsf == 256 { assert_eq!((mv0, mv1), (col, [0, 0]), "dsf 256 is the identity scale"); } - // soundcraft#994: mvL1 is scaled from the unclamped mvL0 with only the results - // clipped — deriving it from the clipped mvL0 gave [0, 0] here. - if dsf == 512 && col == [i16::MAX, 0] { - assert_eq!((mv0, mv1), ([i16::MAX, 0], [i16::MAX, 0]), "mvL1 keeps mvL0's off-range part"); - } } } + // soundcraft#994: mvL1 is scaled from the unclamped mvL0 with only the results clipped; + // deriving it from the clipped mvL0 gave [0, 0] here. + let (mv0, mv1) = SliceDecoder::temporal_direct_mvs(512, [i16::MAX, 0]); + assert_eq!((mv0, mv1), ([i16::MAX, 0], [i16::MAX, 0]), "mvL1 keeps mvL0's off-range part"); } } From 78b64ed2fc0e97ef5d84427c7f90f53faff772cd Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 24 Oct 2026 20:22:00 -0700 Subject: [PATCH 006/716] Format: OK in the Font dialog keeps a preset or system text color The Font dialog got a preset text color as its bare name, which dropped its transforms, and a system color as its last RGB value, which dropped the system color. Pressing OK then replaced the run's color: a preset "red" at 50% luminance came back as plain red. `color_command_value` now writes `{"preset": name}` and `{"system": name, "last": "#RRGGBB"}` with the transforms, and `color_value` reads both forms. The dialog's Color field shows the preset's name or the system color's last value. --- crates/engine/src/cmd/format.rs | 29 ++++++++++++++++++++++-- crates/engine/src/cmd/mod.rs | 7 ++++++ crates/ui-egui/src/dialogs.rs | 2 +- crates/ui-egui/src/font_dialog_tests.rs | 30 +++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/format.rs b/crates/engine/src/cmd/format.rs index a3b2c40a4..31ab7290d 100644 --- a/crates/engine/src/cmd/format.rs +++ b/crates/engine/src/cmd/format.rs @@ -597,8 +597,15 @@ fn color_command_value(c: &deckcraft_model::ColorRef) -> Value { o.insert("scheme".into(), json!(slot.xml_name())); Value::Object(o) } - ColorBase::Preset { name } => json!(name), - ColorBase::System { last, .. } => json!(format!("#{}", last.hex())), + ColorBase::Preset { name } => { + o.insert("preset".into(), json!(name)); + Value::Object(o) + } + ColorBase::System { name, last } => { + o.insert("system".into(), json!(name)); + o.insert("last".into(), json!(format!("#{}", last.hex()))); + Value::Object(o) + } } } @@ -1497,6 +1504,24 @@ mod tests { assert!(r.size.is_none() && r.fill.is_none()); } + #[test] + fn font_dialog_ok_keeps_preset_and_system_colors() { + let preset = ColorRef { base: ColorBase::Preset { name: "red".into() }, mods: vec![] }.with(ColorTransform::LumMod(50_000)); + let system = + ColorRef { base: ColorBase::System { name: "windowText".into(), last: deckcraft_color::Rgba::rgb(0x12, 0x34, 0x56) }, mods: vec![] } + .with(ColorTransform::Alpha(60_000)); + for color in [preset, system] { + let mut s = shape(); + let fill = Fill::Solid { color: color.clone() }; + format_run(&mut s, &|r| r.fill = Some(fill.clone())).unwrap(); + s.ui_requests.clear(); + s.execute("format.fontDialog", &json!({})).unwrap(); + let Some(UiRequest::Dialog { params, .. }) = s.ui_requests.last().cloned() else { panic!("dialog request") }; + s.execute("format.fontDialog", &json!({"color": params["color"]})).unwrap(); + assert_eq!(props(&s).fill, Some(Fill::Solid { color }), "{}", params["color"]); + } + } + #[test] fn font_dialog_with_no_fields_asks_the_ui_to_open() { let mut s = shape(); diff --git a/crates/engine/src/cmd/mod.rs b/crates/engine/src/cmd/mod.rs index fa3f64598..e2442025c 100644 --- a/crates/engine/src/cmd/mod.rs +++ b/crates/engine/src/cmd/mod.rs @@ -371,6 +371,8 @@ pub(crate) fn ok() -> Result { } /// Parse a colour param: `"#RRGGBB"`, `"accent1"`…, or `{"scheme":"accent2","lumMod":75000}`. +/// A preset or system colour keeps its base: `{"preset":"red"}`, +/// `{"system":"windowText","last":"#000000"}`. pub(crate) fn color_param(p: &Value, key: &str) -> Option { let v = p.get(key)?; color_value(v) @@ -391,6 +393,11 @@ pub(crate) fn color_value(v: &Value) -> Option { Value::Object(o) => { let mut c = if let Some(s) = o.get("scheme").and_then(Value::as_str) { ColorRef::scheme(deckcraft_color::SchemeSlot::from_xml(s)?) + } else if let Some(name) = o.get("preset").and_then(Value::as_str) { + ColorRef { base: deckcraft_model::ColorBase::Preset { name: name.to_string() }, mods: vec![] } + } else if let Some(name) = o.get("system").and_then(Value::as_str) { + let last = deckcraft_color::Rgba::from_hex(o.get("last").and_then(Value::as_str)?)?; + ColorRef { base: deckcraft_model::ColorBase::System { name: name.to_string(), last }, mods: vec![] } } else { ColorRef::rgb(deckcraft_color::Rgba::from_hex(o.get("rgb").and_then(Value::as_str)?)?) }; diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index e0fa02e95..e6a70f168 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -2798,7 +2798,7 @@ fn json_text(v: Option<&Value>, default: &str) -> String { fn color_label(v: &Value) -> String { match v { Value::String(s) => s.clone(), - Value::Object(o) => o.get("scheme").or_else(|| o.get("rgb")).and_then(Value::as_str).unwrap_or("").to_string(), + Value::Object(o) => ["scheme", "rgb", "preset", "last"].iter().find_map(|k| o.get(*k)).and_then(Value::as_str).unwrap_or("").to_string(), _ => String::new(), } } diff --git a/crates/ui-egui/src/font_dialog_tests.rs b/crates/ui-egui/src/font_dialog_tests.rs index 06ccfc024..e3076c62a 100644 --- a/crates/ui-egui/src/font_dialog_tests.rs +++ b/crates/ui-egui/src/font_dialog_tests.rs @@ -63,3 +63,33 @@ fn command_t_opens_the_font_dialog_and_cancel_keeps_the_text() { assert!(h.state().dialog.is_none()); assert_eq!(bold_of(&h), None); } + +#[test] +fn preset_and_system_colors_show_in_the_dialog_and_ok_keeps_them() { + for (color, shown) in + [(json!({"preset": "red", "lumMod": 50000}), "red"), (json!({"system": "windowText", "last": "#123456", "alpha": 60000}), "#123456")] + { + let mut h = harness(); + h.state_mut().session.execute("format.fontDialog", &json!({ "color": color })).unwrap(); + let before = fill_of(&h); + assert!(before.is_some()); + h.get_by_label("Font…").click(); + h.run_steps(2); + let d = h.state().dialog.as_ref().expect("font dialog"); + assert_eq!(d.fields.get("color").map(String::as_str), Some(shown)); + h.get_by_label("OK").click_accesskit(); + h.run_steps(1); + assert!(h.state().dialog.is_none(), "status {:?}", h.state().status); + assert_eq!(fill_of(&h), before, "{shown}"); + } +} + +fn fill_of(h: &Harness<'_, SlideApp>) -> Option { + let st = h.state().session.active().unwrap(); + st.selected_shapes() + .first() + .and_then(|sh| sh.text.as_ref()) + .and_then(|t| t.paragraphs.first()) + .and_then(|p| p.runs.first()) + .and_then(|r| r.props.fill.clone()) +} From aa0afa1462cb933b08663001d7a8d0fcdc0b26d2 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 24 Oct 2026 21:14:43 -0700 Subject: [PATCH 007/716] Format: the Font dialog's color keeps inv, comp and gray, and a color's alpha A transform without a value (inv, comp, gray) is written as `true`, and an RGB or a system color's last value that is not opaque is written as `#RRGGBBAA`, so OK in the Font dialog keeps both. --- crates/engine/src/cmd/format.rs | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/crates/engine/src/cmd/format.rs b/crates/engine/src/cmd/format.rs index 31ab7290d..b1e01ae93 100644 --- a/crates/engine/src/cmd/format.rs +++ b/crates/engine/src/cmd/format.rs @@ -583,14 +583,15 @@ fn color_command_value(c: &deckcraft_model::ColorRef) -> Value { use deckcraft_model::ColorBase; let mut o = serde_json::Map::new(); for m in &c.mods { - if let Some(v) = m.value() { - o.insert(m.xml_name().to_string(), json!(v)); - } + // `inv`, `comp` and `gray` have no value. + o.insert(m.xml_name().to_string(), m.value().map_or(json!(true), |v| json!(v))); } + // `#RRGGBB`, or `#RRGGBBAA` for a colour that is not opaque. + let hex = |c: &deckcraft_color::Rgba| if c.a == 255 { format!("#{}", c.hex()) } else { format!("#{}{:02X}", c.hex(), c.a) }; match &c.base { - ColorBase::Rgb { rgb } if o.is_empty() => json!(format!("#{}", rgb.hex())), + ColorBase::Rgb { rgb } if o.is_empty() => json!(hex(rgb)), ColorBase::Rgb { rgb } => { - o.insert("rgb".into(), json!(format!("#{}", rgb.hex()))); + o.insert("rgb".into(), json!(hex(rgb))); Value::Object(o) } ColorBase::Scheme { slot } => { @@ -603,7 +604,7 @@ fn color_command_value(c: &deckcraft_model::ColorRef) -> Value { } ColorBase::System { name, last } => { o.insert("system".into(), json!(name)); - o.insert("last".into(), json!(format!("#{}", last.hex()))); + o.insert("last".into(), json!(hex(last))); Value::Object(o) } } @@ -1505,12 +1506,16 @@ mod tests { } #[test] - fn font_dialog_ok_keeps_preset_and_system_colors() { + fn font_dialog_ok_keeps_the_text_color() { + use deckcraft_color::Rgba; let preset = ColorRef { base: ColorBase::Preset { name: "red".into() }, mods: vec![] }.with(ColorTransform::LumMod(50_000)); - let system = - ColorRef { base: ColorBase::System { name: "windowText".into(), last: deckcraft_color::Rgba::rgb(0x12, 0x34, 0x56) }, mods: vec![] } - .with(ColorTransform::Alpha(60_000)); - for color in [preset, system] { + let system = ColorRef { base: ColorBase::System { name: "windowText".into(), last: Rgba::rgb(0x12, 0x34, 0x56) }, mods: vec![] } + .with(ColorTransform::Alpha(60_000)); + // A transform without a value, and a colour that is not opaque. + let inverted = ColorRef { base: ColorBase::Preset { name: "red".into() }, mods: vec![] }.with(ColorTransform::Inv); + let translucent = ColorRef { base: ColorBase::System { name: "windowText".into(), last: Rgba::rgba(0x12, 0x34, 0x56, 0x80) }, mods: vec![] }; + let rgb = ColorRef::rgb(Rgba::rgba(0x12, 0x34, 0x56, 0x80)); + for color in [preset, system, inverted, translucent, rgb] { let mut s = shape(); let fill = Fill::Solid { color: color.clone() }; format_run(&mut s, &|r| r.fill = Some(fill.clone())).unwrap(); From 36bf5591c1b4f83bafed23539ef28faf4a8a89b4 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 25 Oct 2026 08:57:11 -0700 Subject: [PATCH 008/716] Format: spell color the American way in the new comments --- crates/engine/src/cmd/format.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd/format.rs b/crates/engine/src/cmd/format.rs index 7fba5ce04..dcb4ba3b8 100644 --- a/crates/engine/src/cmd/format.rs +++ b/crates/engine/src/cmd/format.rs @@ -594,7 +594,7 @@ fn color_command_value(c: &deckcraft_model::ColorRef) -> Value { // `inv`, `comp` and `gray` have no value. o.insert(m.xml_name().to_string(), m.value().map_or(json!(true), |v| json!(v))); } - // `#RRGGBB`, or `#RRGGBBAA` for a colour that is not opaque. + // `#RRGGBB`, or `#RRGGBBAA` for a color that is not opaque. let hex = |c: &deckcraft_color::Rgba| if c.a == 255 { format!("#{}", c.hex()) } else { format!("#{}{:02X}", c.hex(), c.a) }; match &c.base { ColorBase::Rgb { rgb } if o.is_empty() => json!(hex(rgb)), @@ -1552,7 +1552,7 @@ mod tests { let preset = ColorRef { base: ColorBase::Preset { name: "red".into() }, mods: vec![] }.with(ColorTransform::LumMod(50_000)); let system = ColorRef { base: ColorBase::System { name: "windowText".into(), last: Rgba::rgb(0x12, 0x34, 0x56) }, mods: vec![] } .with(ColorTransform::Alpha(60_000)); - // A transform without a value, and a colour that is not opaque. + // A transform without a value, and a color that is not opaque. let inverted = ColorRef { base: ColorBase::Preset { name: "red".into() }, mods: vec![] }.with(ColorTransform::Inv); let translucent = ColorRef { base: ColorBase::System { name: "windowText".into(), last: Rgba::rgba(0x12, 0x34, 0x56, 0x80) }, mods: vec![] }; let rgb = ColorRef::rgb(Rgba::rgba(0x12, 0x34, 0x56, 0x80)); From 37ac38cac784fb60fbff0358d539fdaaed629d97 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 25 Oct 2026 13:26:55 -0700 Subject: [PATCH 009/716] Format: the Font dialog keeps the order of a color's transforms The dialog's color parameter lists transforms in order under `mods`, in the form the model stores them, so OK keeps repeats such as [inv, inv] and transforms that are not in alphabetical order. Color parameters accept `mods` alongside the keyed form. --- crates/engine/src/cmd/format.rs | 11 +++++++---- crates/engine/src/cmd/mod.rs | 11 ++++++++++- crates/ui-egui/src/font_dialog_tests.rs | 9 ++++++--- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/crates/engine/src/cmd/format.rs b/crates/engine/src/cmd/format.rs index dcb4ba3b8..8b8785aa8 100644 --- a/crates/engine/src/cmd/format.rs +++ b/crates/engine/src/cmd/format.rs @@ -590,9 +590,9 @@ fn font_edits(p: &Value) -> Result { fn color_command_value(c: &deckcraft_model::ColorRef) -> Value { use deckcraft_model::ColorBase; let mut o = serde_json::Map::new(); - for m in &c.mods { - // `inv`, `comp` and `gray` have no value. - o.insert(m.xml_name().to_string(), m.value().map_or(json!(true), |v| json!(v))); + // An ordered list, so the order of the transforms and repeated ones such as `[inv, inv]` are kept. + if !c.mods.is_empty() { + o.insert("mods".into(), json!(c.mods)); } // `#RRGGBB`, or `#RRGGBBAA` for a color that is not opaque. let hex = |c: &deckcraft_color::Rgba| if c.a == 255 { format!("#{}", c.hex()) } else { format!("#{}{:02X}", c.hex(), c.a) }; @@ -1556,7 +1556,10 @@ mod tests { let inverted = ColorRef { base: ColorBase::Preset { name: "red".into() }, mods: vec![] }.with(ColorTransform::Inv); let translucent = ColorRef { base: ColorBase::System { name: "windowText".into(), last: Rgba::rgba(0x12, 0x34, 0x56, 0x80) }, mods: vec![] }; let rgb = ColorRef::rgb(Rgba::rgba(0x12, 0x34, 0x56, 0x80)); - for color in [preset, system, inverted, translucent, rgb] { + // A repeated transform, and two transforms in an order that is not alphabetical. + let twice = inverted.clone().with(ColorTransform::Inv); + let ordered = ColorRef::scheme(SchemeSlot::Accent2).with(ColorTransform::LumOff(20_000)).with(ColorTransform::LumMod(50_000)); + for color in [preset, system, inverted, translucent, rgb, twice, ordered] { let mut s = shape(); let fill = Fill::Solid { color: color.clone() }; format_run(&mut s, &|r| r.fill = Some(fill.clone())).unwrap(); diff --git a/crates/engine/src/cmd/mod.rs b/crates/engine/src/cmd/mod.rs index f0f1141fb..9c6aadd2f 100644 --- a/crates/engine/src/cmd/mod.rs +++ b/crates/engine/src/cmd/mod.rs @@ -372,7 +372,8 @@ pub(crate) fn ok() -> Result { /// Parse a colour param: `"#RRGGBB"`, `"accent1"`…, or `{"scheme":"accent2","lumMod":75000}`. /// A preset or system colour keeps its base: `{"preset":"red"}`, -/// `{"system":"windowText","last":"#000000"}`. +/// `{"system":"windowText","last":"#000000"}`. `"mods"` lists transforms in order: +/// `{"preset":"red","mods":[{"op":"inv"},{"op":"inv"}]}`. pub(crate) fn color_param(p: &Value, key: &str) -> Option { let v = p.get(key)?; color_value(v) @@ -412,6 +413,10 @@ pub(crate) fn color_value(v: &Value) -> Option { c.mods.push(t); } } + // `mods` lists transforms in order, repeats included: `[{"op":"inv"},{"op":"lumMod","val":50000}]`. + if let Some(list) = o.get("mods") { + c.mods.extend(serde_json::from_value::>(list.clone()).ok()?); + } Some(c) } _ => None, @@ -669,5 +674,9 @@ mod tests { assert!(color_value(&json!({"preset": name})).is_some(), "{name}"); } assert!(color_value(&json!({"system": "3dDkShadow", "last": "#000000"})).is_some()); + let listed = color_value(&json!({"preset": "red", "mods": [{"op": "inv"}, {"op": "lumOff", "val": 20_000}, {"op": "inv"}]})); + let mods = vec![ColorTransform::Inv, ColorTransform::LumOff(20_000), ColorTransform::Inv]; + assert_eq!(listed, Some(ColorRef { base: ColorBase::Preset { name: "red".into() }, mods })); + assert_eq!(color_value(&json!({"preset": "red", "mods": [{"op": "notATransform"}]})), None); } } diff --git a/crates/ui-egui/src/font_dialog_tests.rs b/crates/ui-egui/src/font_dialog_tests.rs index e3076c62a..60b18f02d 100644 --- a/crates/ui-egui/src/font_dialog_tests.rs +++ b/crates/ui-egui/src/font_dialog_tests.rs @@ -66,9 +66,12 @@ fn command_t_opens_the_font_dialog_and_cancel_keeps_the_text() { #[test] fn preset_and_system_colors_show_in_the_dialog_and_ok_keeps_them() { - for (color, shown) in - [(json!({"preset": "red", "lumMod": 50000}), "red"), (json!({"system": "windowText", "last": "#123456", "alpha": 60000}), "#123456")] - { + for (color, shown) in [ + (json!({"preset": "red", "lumMod": 50000}), "red"), + (json!({"system": "windowText", "last": "#123456", "alpha": 60000}), "#123456"), + (json!({"preset": "red", "mods": [{"op": "inv"}, {"op": "inv"}]}), "red"), + (json!({"scheme": "accent2", "mods": [{"op": "lumOff", "val": 20000}, {"op": "lumMod", "val": 50000}]}), "accent2"), + ] { let mut h = harness(); h.state_mut().session.execute("format.fontDialog", &json!({ "color": color })).unwrap(); let before = fill_of(&h); From 5c179822d9c076443ade930d85aa4647abcde033 Mon Sep 17 00:00:00 2001 From: SofiaAFigueredo Date: Sun, 25 Oct 2026 18:53:05 -0300 Subject: [PATCH 010/716] fix(show): start a slide transition's clock after its first frame is rendered (#1385) The clock started at the key press, but the new slide (and, for Pan, Reveal and similar transitions, four more pictures) is rendered on the UI thread before the first transition frame. When that took longer than the transition's duration, the first drawn frame was already past the end and the next slide appeared with no transition. The first frame now renders the slide and the pictures while showing the start of the transition, and the clock starts on the frame after it. Co-Authored-By: Claude Sonnet 5.5 --- crates/ui-egui/src/show.rs | 55 +++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/show.rs b/crates/ui-egui/src/show.rs index 7055f9b2f..0b9cd22aa 100644 --- a/crates/ui-egui/src/show.rs +++ b/crates/ui-egui/src/show.rs @@ -271,12 +271,37 @@ struct Transition { /// moves contents over backgrounds (Pan, Ferris Wheel, Reveal…): old back, old content, new /// back, new content. parts: Option<[Option; 4]>, + /// When the transition's clock started. `apply` sets it to the time of the key press; the + /// first frames of the transition re-anchor it (see `progress`), because rendering the new + /// slide and the transition's pictures can take longer than the whole transition (#1385). start: f64, + /// The first frame of the transition has been drawn: the new slide and the pictures the + /// transition needs exist, so the time they took is not part of the transition. + primed: bool, + /// `start` was moved to the frame after the first one. + anchored: bool, kind: String, option: String, dur: f64, } +impl Transition { + /// How far the transition has come at frame time `now`, from 0 to 1. The first frame is the + /// one that renders the new slide and the transition's pictures and the second one starts the + /// clock, so a slow render never eats the transition's duration (#1385). + fn progress(&mut self, now: f64) -> f64 { + if !self.primed { + self.primed = true; + return 0.0; + } + if !self.anchored { + self.anchored = true; + self.start = now; + } + ((now - self.start) / self.dur.max(0.01)).clamp(0.0, 1.0) + } +} + /// A copy of the show's clock origins for regressions that must not depend on wall time. #[cfg(test)] #[derive(Clone, Copy, Debug, PartialEq)] @@ -583,7 +608,7 @@ impl Show { self.last_viewed = from; } self.trans = if kind != "none" && dur > 0.0 && !doc.show.without_animation { - Some(Transition { old, from, morph: None, parts: None, start: now, kind, option, dur }) + Some(Transition { old, from, morph: None, parts: None, start: now, primed: false, anchored: false, kind, option, dur }) } else { None }; @@ -1091,11 +1116,12 @@ pub fn ui(app: &mut SlideApp, ui: &mut Ui) { } } let mut drew = false; - let morphing = show.trans.as_ref().is_some_and(|tr| tr.kind == "morph" && tr.from.is_some() && now - tr.start < tr.dur); + let progress = show.trans.as_mut().map(|tr| tr.progress(now)); + let morphing = show.trans.as_ref().is_some_and(|tr| tr.kind == "morph" && tr.from.is_some()) && progress.is_some_and(|p| p < 1.0); let tl = if morphing { Some(show.timeline(&doc).clone()) } else { None }; let morph = match (&show.trans, tl) { (Some(tr), Some(tl)) => { - let p = ((now - tr.start) / tr.dur.max(0.01)).clamp(0.0, 1.0); + let p = progress.unwrap_or(1.0); let hidden_b = |id: ShapeId| { let st = state_for(&tl, id, 0, 0.0, &[], &[]); !st.visible || st.opacity <= 0.0 || hidden.contains(&id) @@ -1137,7 +1163,7 @@ pub fn ui(app: &mut SlideApp, ui: &mut Ui) { drew = true; ctx.request_repaint(); } else if let (Some(tr), Some(new)) = (show.trans.as_mut(), &tex) { - let p = ((now - tr.start) / tr.dur.max(0.01)).clamp(0.0, 1.0); + let p = progress.unwrap_or(1.0); if p < 1.0 { // Slides split into background and content are rendered once per transition; // every frame only composites cached textures. @@ -2795,6 +2821,27 @@ mod tests { assert!(show.tex.is_none(), "the new slide gets a texture of its own instead of overwriting the old one"); } + #[test] + fn a_slow_first_frame_does_not_use_up_the_transition() { + // #1385: the clock started at the key press, so rendering the new slide for longer than the + // transition's duration showed the next slide with no transition at all. + let mut s = deckcraft_engine::Session::with_new(); + s.execute("slide.new", &json!({})).unwrap(); + s.execute("transition.set", &json!({"kind": "fade", "index": 1, "duration": 500})).unwrap(); + let doc = s.active().unwrap().doc.clone(); + let mut show = Show::new(&doc, 0, false, false); + assert!(show.apply(ShowAction::Slide(1), &doc, 10.0)); + let tr = show.trans.as_mut().expect("the fade plays"); + assert!((tr.dur - 0.5).abs() < 1e-9); + // The first frame renders for two seconds; it still shows the start of the transition. + assert_eq!(tr.progress(10.0), 0.0); + // The frame after it starts the clock. + assert_eq!(tr.progress(12.0), 0.0); + assert!((tr.progress(12.25) - 0.5).abs() < 1e-9); + assert_eq!(tr.progress(12.5), 1.0); + assert_eq!(tr.progress(20.0), 1.0); + } + #[test] fn media_in_the_click_sequence_plays_with_its_step() { // #116: media set to play in the click sequence never started; only a click on it did. From b697455ea71100407fac63cfab686dc9593547e3 Mon Sep 17 00:00:00 2001 From: SofiaAFigueredo Date: Sun, 25 Oct 2026 18:57:15 -0300 Subject: [PATCH 011/716] docs(contributors): credit SofiaAFigueredo by real name (#1385) Co-Authored-By: Claude Sonnet 5.5 --- contributors/people.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contributors/people.toml b/contributors/people.toml index 20fed3bcc..31dccab20 100644 --- a/contributors/people.toml +++ b/contributors/people.toml @@ -65,3 +65,6 @@ sync_github_name = true [people.Katacc] sync_github_name = true + +[people.SofiaAFigueredo] +real_name = "Sofia Alves Figueredo" From 877e6db673f7a5a9fd5b182abb8103d684411afa Mon Sep 17 00:00:00 2001 From: SofiaAFigueredo Date: Sun, 25 Oct 2026 19:05:43 -0300 Subject: [PATCH 012/716] fix(show): a hidden show expires a transition from the key press (#1385) Re-anchoring `start` for the drawn transition delayed the hidden show's expiration by the time between the press and the second frame. The press time stays in `start`; the drawn clock is its own field. Co-Authored-By: Claude Sonnet 5.5 --- crates/ui-egui/src/show.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/ui-egui/src/show.rs b/crates/ui-egui/src/show.rs index 0b9cd22aa..449d63558 100644 --- a/crates/ui-egui/src/show.rs +++ b/crates/ui-egui/src/show.rs @@ -271,15 +271,16 @@ struct Transition { /// moves contents over backgrounds (Pan, Ferris Wheel, Reveal…): old back, old content, new /// back, new content. parts: Option<[Option; 4]>, - /// When the transition's clock started. `apply` sets it to the time of the key press; the - /// first frames of the transition re-anchor it (see `progress`), because rendering the new - /// slide and the transition's pictures can take longer than the whole transition (#1385). + /// The time of the key press. A hidden show, which draws nothing, expires the transition + /// from it. start: f64, + /// Where the drawn transition's clock starts: the frame after the first one (see `progress`), + /// because rendering the new slide and the transition's pictures can take longer than the + /// whole transition (#1385). `None` until then. + clock: Option, /// The first frame of the transition has been drawn: the new slide and the pictures the /// transition needs exist, so the time they took is not part of the transition. primed: bool, - /// `start` was moved to the frame after the first one. - anchored: bool, kind: String, option: String, dur: f64, @@ -294,11 +295,8 @@ impl Transition { self.primed = true; return 0.0; } - if !self.anchored { - self.anchored = true; - self.start = now; - } - ((now - self.start) / self.dur.max(0.01)).clamp(0.0, 1.0) + let clock = *self.clock.get_or_insert(now); + ((now - clock) / self.dur.max(0.01)).clamp(0.0, 1.0) } } @@ -608,7 +606,7 @@ impl Show { self.last_viewed = from; } self.trans = if kind != "none" && dur > 0.0 && !doc.show.without_animation { - Some(Transition { old, from, morph: None, parts: None, start: now, primed: false, anchored: false, kind, option, dur }) + Some(Transition { old, from, morph: None, parts: None, start: now, clock: None, primed: false, kind, option, dur }) } else { None }; @@ -2840,6 +2838,8 @@ mod tests { assert!((tr.progress(12.25) - 0.5).abs() < 1e-9); assert_eq!(tr.progress(12.5), 1.0); assert_eq!(tr.progress(20.0), 1.0); + // A hidden show still expires it from the key press. + assert_eq!(tr.start, 10.0); } #[test] From d8936f94af1dd1a9a9c72cb626c5a0062ed19abb Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Tue, 27 Oct 2026 10:58:38 +0100 Subject: [PATCH 013/716] Keep whole character after a backslash in RTF outline import Found while testing crates/format/src/rtf.rs:301-326 (symbol / text, reached via escape) Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/format/src/rtf.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/format/src/rtf.rs b/crates/format/src/rtf.rs index 4800aba26..b546a832f 100644 --- a/crates/format/src/rtf.rs +++ b/crates/format/src/rtf.rs @@ -299,7 +299,8 @@ impl Outline<'_> { /// A one-character control symbol (`\\`, `\{`, `\~`, ...). fn symbol(&mut self, n: u8) { - self.i += 1; + let c = self.rtf.get(self.i..).and_then(|r| r.chars().next()); + self.i = advance(self.rtf, self.i, 1); if self.st.skip { return; } @@ -308,6 +309,7 @@ impl Outline<'_> { b'~' => self.line.push('\u{a0}'), b'_' => self.line.push('\u{2011}'), b'\n' | b'\r' => self.flush(), + _ if !n.is_ascii() => self.line.extend(c), _ => {} } } @@ -419,6 +421,11 @@ mod tests { assert_eq!(rtf_to_outline(r"{\rtf1 x\u-70000?y\par}"), "x\u{ee90}y\n"); } + #[test] + fn multibyte_control_symbol_keeps_character_and_following_text() { + assert_eq!(rtf_to_outline("{\\rtf1 A\\éB\\par}"), "AéB\n"); + } + /// `\\_` is RTF's non-breaking hyphen: a visible character, not markup. #[test] fn non_breaking_hyphen_is_kept() { From 11362ac715857a6721873ffbff08ad2ba4a2d938 Mon Sep 17 00:00:00 2001 From: Harrison Booth <73434116+Harrison-Booth@users.noreply.github.com> Date: Tue, 27 Oct 2026 19:13:21 -0500 Subject: [PATCH 014/716] docs: path map for the #1433 module split; drop CLAUDE.md references to the gitignored plan/ directory --- CLAUDE.md | 6 ++-- docs/module-split-map.md | 67 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 docs/module-split-map.md diff --git a/CLAUDE.md b/CLAUDE.md index 67853ff06..334385580 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,7 +4,7 @@ Read [AGENTS.md](AGENTS.md) first: its rules (asset policy, clean room, never cr win over anything here. ## Start every session -1. Read `plan/STATUS.md`, then the current milestone in `plan/execution-plan.md`. +1. Read `ROADMAP.md` and `docs/roadmap.md`. 2. Read `../../craftrules/AGENTS.md` and the standards it lists for your task. 3. Run `cargo xtask ci` before you change anything, so you know the tree is green. @@ -13,5 +13,5 @@ win over anything here. - Look at UI changes: `deckcraft --sample --control 7990` + `ui.screenshot`, or `deckcraft-cli render`. - Commit after each landed arc (`M.: what`) and push to `origin main`. -- Keep `ROADMAP.md`, the progress docs in `docs/` (AGENTS.md §7) and `plan/STATUS.md` current. -- Don't ask the user questions; record genuinely-theirs decisions in `plan/STATUS.md`. +- Keep `ROADMAP.md` and the progress docs in `docs/` (AGENTS.md §7) current. +- Don't ask the user questions; record genuinely-theirs decisions in `ROADMAP.md`. diff --git a/docs/module-split-map.md b/docs/module-split-map.md new file mode 100644 index 000000000..fc1ba1d38 --- /dev/null +++ b/docs/module-split-map.md @@ -0,0 +1,67 @@ +# Where things moved in #1433 + +[#1433](https://github.com/storytold/deckcraft/pull/1433) (merge `ee875abf`) split the largest +source files into modules. Nothing changed in behaviour, but a branch that edits an old file now +conflicts with it. This note says which new modules received each old file's code, so you can place +your hunks by hand after `git merge origin/main`. Paths are relative to `crates/` unless noted; each +old file stays as the parent module and keeps its re-exports, so import paths are unchanged. + +To find the exact new home of one function: `git grep -n 'fn name' origin/main -- crates` (or +`git log -S'fn name' --oneline origin/main -- crates`). + +## Plain renames (content unchanged) + +| Old | New | +|---|---| +| `engine/src/cmd/mod.rs` | `engine/src/cmd.rs` | +| `opus/src/celt/mod.rs`, `opus/src/silk/mod.rs` | `opus/src/celt.rs`, `opus/src/silk.rs` | +| `pptx/src/read/mod.rs`, `pptx/src/write/mod.rs` | `pptx/src/read.rs`, `pptx/src/write.rs` | +| `ui-egui/src/backstage_tests.rs` | `ui-egui/src/backstage/tests.rs` | +| `ui-egui/src/selpane_tests.rs`, `sorter_tests.rs` | `ui-egui/src/panels/selpane/ui_tests.rs`, `ui-egui/src/sorter/ui_tests.rs` | + +`ui-egui/src` files moved into a folder: `guides_tests`, `preview`, `ruler_tests`, `squiggles` → +`canvas/`; `columns_dialog_tests`, `credits`, `font_dialog_tests`, `paragraph_dialog_tests`, +`photo_album_tests`, `preferences_tests`, `size_position_tests`, `spelling_tests`, +`theme_colors_tests`, `theme_fonts_tests`, `updates_ui` → `dialogs/`; `animtimeline`, +`background_tests`, `fillui`, `notes`, `pattern_fill_tests`, `smartart_tests`, `thesaurus_tests`, +`thumbs` → `panels/`; `align_tests`, `drawtable_tests`, `effects_tests`, `icons_popup_tests`, +`inktoshape_tests`, `master_layout_tests`, `qat` → `ribbon/`. + +## Split files (old file → new modules, all under the old file's folder) + +Each old file now holds only the module list and shared items. + +| Old file | New modules | +|---|---| +| `apps/deckcraft/src/control_server.rs` | `control_server/tests.rs` (its tests) | +| `engine/src/cmd/design.rs` | `design/{colors, master_view, slide_background, slide_setup, browse_theme_tests, tests}.rs` | +| `engine/src/cmd/format.rs` | `format/{font, paragraph, painter, ruler, text_effects}.rs` | +| `engine/src/cmd/insert.rs` | `insert/{album, chart, links, picture, text_fields, icon_and_picture_tests}.rs` | +| `engine/src/cmd/shape.rs` | `shape/{appearance, freeform, picture, size}.rs` | +| `engine/src/cmd/smartart.rs` | `smartart/{diagrams, edit, layout, nodes, paint}.rs` | +| `engine/src/cmd/text.rs` | `text/{autocorrect, caret, editing, formatting, ime, layout}.rs` | +| `engine/src/tools.rs` | `tools/{click, drag, geometry, hit, pointer}.rs` | +| `fonts/src/lib.rs`, `format/src/lib.rs` | `src/tests.rs` (their tests) | +| `geom/src/preset.rs` | `preset/{build, builder, catalog, shapes, tests}.rs` | +| `media/src/player.rs` | `player/tests.rs` | +| `render/src/lib.rs` | `src/{geometry, opts, raster, renderer, slide, stroke, text_draw}.rs` | +| `text/src/lib.rs` | `src/{autonum, breaking, layout, run, shape, symbol}.rs` | +| `ui-egui/src/lib.rs` | `src/{app, state, services, clock, ime_hooks, tests}.rs`; the `SlideApp` impl is in `app.rs` and `app/{clipboard, commands, control, files, frame, ime, input, keys, playback}.rs` | +| `ui-egui/src/panes.rs` (deleted) | `panels.rs` and `panels/{animation, background, comments, designer, format_shape, smartart, thesaurus}.rs` (format-shape pane → `format_shape.rs`, slide background → `background.rs`, animation pane → `animation.rs`, comments and revisions → `comments.rs`) | +| `ui-egui/src/backstage.rs` | `backstage/{files, info, print}.rs` | +| `ui-egui/src/canvas.rs` | `canvas/{context_menu, guides, ime, input, media, overlays, rulers, scroll, tests}.rs` | +| `ui-egui/src/capture.rs` | `capture/tests.rs` | +| `ui-egui/src/dialogs.rs` | `dialogs/{about, alt_text, body, columns, date_time, equation, export, find, font, grid_options, hyperlink, language, paragraph, photo_album, preferences, size_position, slide_size, tabs, theme_colors, theme_fonts, trim, zoom, tests}.rs`; dialogs not listed (for example most bodies) are in `body.rs` | +| `ui-egui/src/icons.rs` | `icons/{draw, geometry}.rs` | +| `ui-egui/src/ribbon.rs` | `ribbon/{animations, arrange, chart, design, draw, galleries, home, insert, masters, picture_format, playback, review, shape_format, slide_show, smartart, table, title_bar, transitions, view}.rs`; one file per ribbon tab, plus `galleries.rs` for the shared gallery popups | +| `ui-egui/src/show.rs` | `show/{keys, media, presenter, render, ui, zoom, tests}.rs` | + +Also touched: `engine/src/file_access.rs` (16 lines), `docs/file-format-parity.md`, `docs/gaps.md` +and `packaging/common.sh` (one line each, path references). + +## Carrying a branch forward + +1. `git merge origin/main` (never rebase) and let git list the conflicting old files. +2. For each conflicting hunk, find the new module above, apply the hunk there by hand, and keep + the old file's side only for module declarations. +3. Run `cargo xtask ci`. From 1da4e33490aefdeae565bbb2ac63fdc0b162d0d9 Mon Sep 17 00:00:00 2001 From: Harrison Booth <73434116+Harrison-Booth@users.noreply.github.com> Date: Tue, 27 Oct 2026 20:53:24 -0500 Subject: [PATCH 015/716] docs: qualify what the old files keep, list style.rs, say where panes.rs hunks go --- docs/module-split-map.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/module-split-map.md b/docs/module-split-map.md index fc1ba1d38..7ee0f7ce1 100644 --- a/docs/module-split-map.md +++ b/docs/module-split-map.md @@ -29,7 +29,8 @@ To find the exact new home of one function: `git grep -n 'fn name' origin/main - ## Split files (old file → new modules, all under the old file's folder) -Each old file now holds only the module list and shared items. +Each old file keeps its module declarations and any code that was not moved; several rows move +only the tests. | Old file | New modules | |---|---| @@ -45,7 +46,7 @@ Each old file now holds only the module list and shared items. | `geom/src/preset.rs` | `preset/{build, builder, catalog, shapes, tests}.rs` | | `media/src/player.rs` | `player/tests.rs` | | `render/src/lib.rs` | `src/{geometry, opts, raster, renderer, slide, stroke, text_draw}.rs` | -| `text/src/lib.rs` | `src/{autonum, breaking, layout, run, shape, symbol}.rs` | +| `text/src/lib.rs` | `src/{autonum, breaking, layout, run, shape, style, symbol}.rs` | | `ui-egui/src/lib.rs` | `src/{app, state, services, clock, ime_hooks, tests}.rs`; the `SlideApp` impl is in `app.rs` and `app/{clipboard, commands, control, files, frame, ime, input, keys, playback}.rs` | | `ui-egui/src/panes.rs` (deleted) | `panels.rs` and `panels/{animation, background, comments, designer, format_shape, smartart, thesaurus}.rs` (format-shape pane → `format_shape.rs`, slide background → `background.rs`, animation pane → `animation.rs`, comments and revisions → `comments.rs`) | | `ui-egui/src/backstage.rs` | `backstage/{files, info, print}.rs` | @@ -63,5 +64,7 @@ and `packaging/common.sh` (one line each, path references). 1. `git merge origin/main` (never rebase) and let git list the conflicting old files. 2. For each conflicting hunk, find the new module above, apply the hunk there by hand, and keep - the old file's side only for module declarations. + the old file's side only for module declarations. `ui-egui/src/panes.rs` is deleted: do not + restore it, move its hunks into `panels.rs` or the listed `panels/` modules (the crate exposes + `panels` and aliases it as `panes`). 3. Run `cargo xtask ci`. From 64d3127fe85cfdab48fd56ce2d888cec24b91676 Mon Sep 17 00:00:00 2001 From: Hamza Date: Sun, 18 Oct 2026 00:03:38 +0500 Subject: [PATCH 016/716] Header & Footer: an automatic date's format comes back on import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `header_footer()` recorded a Date placeholder's text only when it held no field, and never looked at the field itself, so an automatic date's format was dropped on import: `date_format` stayed empty whatever the deck used. With the dialog of the previous commit that is not only cosmetic. Opening a deck whose dates are `datetime5` showed `datetime1` selected, and pressing Apply then sent that back and reformatted the deck's dates — a silent change to a file the user only opened to look at. The reader now remembers which of the thirteen formats the field is, so the dialog opens on the deck's own choice. An unknown spelling (`datetime`, `datetimeFigureOut`, which both render as the short date) is left as no choice rather than guessed at, since the command only accepts the thirteen and would refuse it. A fixed date still comes back as its text, as before. `crates/pptx` gains a dependency on `crates/text` for `datetime::DATE_KINDS`, which layer 3 may take on layer 2; `cargo xtask layers` passes. --- Cargo.lock | 1 + crates/pptx/Cargo.toml | 1 + crates/pptx/src/read.rs | 27 ++++++++++++--- crates/pptx/tests/header_footer_date.rs | 45 +++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 crates/pptx/tests/header_footer_date.rs diff --git a/Cargo.lock b/Cargo.lock index 01a92e4a5..5aa455924 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1217,6 +1217,7 @@ dependencies = [ "deckcraft-engine", "deckcraft-geom", "deckcraft-model", + "deckcraft-text", "image", "log", "quick-xml 0.41.0", diff --git a/crates/pptx/Cargo.toml b/crates/pptx/Cargo.toml index 0ea79d6b4..8d1e0fc34 100644 --- a/crates/pptx/Cargo.toml +++ b/crates/pptx/Cargo.toml @@ -10,6 +10,7 @@ workspace = true [dependencies] deckcraft-model = { workspace = true } +deckcraft-text = { workspace = true } deckcraft-geom = { workspace = true } deckcraft-color = { workspace = true } quick-xml = { workspace = true } diff --git a/crates/pptx/src/read.rs b/crates/pptx/src/read.rs index 18e8eb92f..412bc8f25 100644 --- a/crates/pptx/src/read.rs +++ b/crates/pptx/src/read.rs @@ -1332,11 +1332,28 @@ fn header_footer(p: &Presentation) -> HeaderFooter { Some(PhType::SlideNum) => hf.slide_number = true, Some(PhType::Date) => { hf.date = true; - if let Some(t) = &sh.text - && !t.paragraphs.iter().flat_map(|p| &p.runs).any(|r| matches!(r.kind, deckcraft_model::text::RunKind::Field { .. })) - && hf.date_text.is_empty() - { - hf.date_text = t.text(); + let field = sh.text.iter().flat_map(|t| t.paragraphs.iter()).flat_map(|p| p.runs.iter()).find_map(|r| match &r.kind { + deckcraft_model::text::RunKind::Field { field } if deckcraft_text::datetime::is_date_field(field) => Some(field.as_str()), + _ => None, + }); + match field { + // An automatic date: remember which of the thirteen formats it is, so the + // Header and Footer dialog opens on the deck's own choice instead of the + // default. An unknown spelling (`datetime`, `datetimeFigureOut`) is left + // as no choice rather than guessed at. + Some(kind) => { + if hf.date_format.is_empty() && deckcraft_text::datetime::DATE_KINDS.contains(&kind) { + hf.date_format = kind.to_string(); + } + } + // A fixed date: its text, as before. + None => { + if hf.date_text.is_empty() + && let Some(t) = &sh.text + { + hf.date_text = t.text(); + } + } } } Some(PhType::Footer) => { diff --git a/crates/pptx/tests/header_footer_date.rs b/crates/pptx/tests/header_footer_date.rs new file mode 100644 index 000000000..99b263082 --- /dev/null +++ b/crates/pptx/tests/header_footer_date.rs @@ -0,0 +1,45 @@ +//! The Header & Footer date through PPTX: an automatic date's format comes back on import, so the +//! dialog opens on the deck's own choice; a fixed date still comes back as its text. + +use deckcraft_model::{Presentation, defaults}; +use serde_json::json; + +/// A deck whose Date placeholders are set up by the engine, exported and imported again. +fn round_trip(args: serde_json::Value) -> Presentation { + let mut s = deckcraft_engine::Session::with_new(); + s.execute("design.headerFooter", &args).expect("headerFooter"); + let p = s.doc().expect("doc").doc.clone(); + let bytes = deckcraft_pptx::export(&p).expect("export"); + deckcraft_pptx::import(&bytes).expect("import") +} + +#[test] +fn an_automatic_dates_format_survives_a_round_trip() { + // A chosen format comes back as the remembered choice. + let q = round_trip(json!({"date": true, "dateFormat": "datetime5", "all": true})); + assert!(q.header_footer.date, "the date placeholder is there"); + assert_eq!(q.header_footer.date_format, "datetime5", "the format is remembered"); + assert_eq!(q.header_footer.date_text, "", "an automatic date has no fixed text"); + + // A different one, so the test cannot pass by always reading datetime5. + let q = round_trip(json!({"date": true, "dateFormat": "datetime11", "all": true})); + assert_eq!(q.header_footer.date_format, "datetime11"); + + // The default: no format asked for, so nothing to remember beyond the field itself. + let q = round_trip(json!({"date": true, "all": true})); + assert_eq!(q.header_footer.date_format, "datetime1", "the placeholder's own field is datetime1"); + + // A fixed date is text, not a field: its text comes back and no format is claimed. + let q = round_trip(json!({"date": true, "dateText": "4 July 1776", "all": true})); + assert_eq!(q.header_footer.date_text, "4 July 1776"); + assert_eq!(q.header_footer.date_format, "", "a fixed date has no format"); +} + +#[test] +fn a_deck_without_a_date_placeholder_claims_no_format() { + let p = defaults::new_presentation(None); + let bytes = deckcraft_pptx::export(&p).expect("export"); + let q = deckcraft_pptx::import(&bytes).expect("import"); + assert!(!q.header_footer.date); + assert_eq!(q.header_footer.date_format, ""); +} From 3a1a74d2aa83f9c17ab602f5e62afb5c67046951 Mon Sep 17 00:00:00 2001 From: Hamza Date: Wed, 28 Oct 2026 20:39:57 +0500 Subject: [PATCH 017/716] format.font: set the East Asian and complex-script typefaces (#786) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A run carries a typeface per script (ECMA-376 §21.1.2.3): `a:latin`, `a:ea` and `a:cs`. `format.font` set only the Latin one, so a CJK run kept drawing -- and saving -- in whatever `a:ea` named before, and there was no way to change it. `eastAsia` and `complexScript` set the other two. Left out they keep their value, which is what the command has always done. A name that is empty or longer than the Font dialog allows is refused rather than stored. Rebased onto main, 637 commits on: engine's format.rs is split, so `font` and `typeface_param` are in cmd/format/font.rs, the command's registry entry stays in cmd/format.rs, and the tests went to cmd/text.rs. --- crates/engine/src/cmd/format.rs | 10 +++- crates/engine/src/cmd/format/font.rs | 32 +++++++++++- crates/engine/src/cmd/text.rs | 73 ++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/format.rs b/crates/engine/src/cmd/format.rs index 6e9e75ce8..25c15c92a 100644 --- a/crates/engine/src/cmd/format.rs +++ b/crates/engine/src/cmd/format.rs @@ -62,7 +62,15 @@ pub fn specs() -> Vec { ), cmd!("format.superscript", "Superscript", ["Home", "Font"], Some("Cmd+Shift+="), "{on?: bool}", has_text_or_shapes, superscript), cmd!("format.subscript", "Subscript", ["Home", "Font"], Some("Cmd+="), "{on?: bool}", has_text_or_shapes, subscript), - cmd!("format.font", "Font", ["Home", "Font"], None, "{family}", has_text_or_shapes, font), + cmd!( + "format.font", + "Font", + ["Home", "Font"], + None, + "{family, eastAsia?: family, complexScript?: family} — `family` is the Latin typeface (`a:latin`); the other two set the East Asian (`a:ea`) and complex-script (`a:cs`) typefaces, which are left alone when not given", + has_text_or_shapes, + font + ), cmd!("format.size", "Font Size", ["Home", "Font"], None, "{size: pt}", has_text_or_shapes, size), cmd!("format.grow", "Increase Font Size", ["Home", "Font"], Some("Cmd+Shift+."), "{}", has_text_or_shapes, grow), cmd!("format.shrink", "Decrease Font Size", ["Home", "Font"], Some("Cmd+Shift+,"), "{}", has_text_or_shapes, shrink), diff --git a/crates/engine/src/cmd/format/font.rs b/crates/engine/src/cmd/format/font.rs index 11af99b7e..db7e4ec6e 100644 --- a/crates/engine/src/cmd/format/font.rs +++ b/crates/engine/src/cmd/format/font.rs @@ -45,9 +45,37 @@ pub(super) fn subscript(s: &mut Session, p: &Value) -> Result { format_run(s, &move |r| r.baseline = Some(if v { -0.25 } else { 0.0 })) } +/// A typeface name from `key`: trimmed, and the length `format.fontDialog` allows. +fn typeface_param(p: &Value, key: &str) -> Result> { + match str_param(p, key) { + None => Ok(None), + Some(v) => { + let t = v.trim(); + if t.is_empty() || t.chars().count() > 200 { + return Err(bad("format.font", format!("`{key}` must be 1-200 characters"))); + } + Ok(Some(t.to_string())) + } + } +} + pub(super) fn font(s: &mut Session, p: &Value) -> Result { - let f = str_param(p, "family").ok_or_else(|| bad("format.font", "missing `family`"))?.to_string(); - format_run(s, &move |r| r.font = Some(f.clone())) + let f = typeface_param(p, "family")?.ok_or_else(|| bad("format.font", "missing `family`"))?; + // A run carries a typeface per script (ECMA-376 §21.1.2.3): `a:latin`, `a:ea` and `a:cs`. + // Setting only the Latin one leaves a CJK run drawing -- and saving -- in whatever `a:ea` + // named before, so the two are settable (#786). Left out, they keep their value, which is + // what `format.font` has always done. + let ea = typeface_param(p, "eastAsia")?; + let cs = typeface_param(p, "complexScript")?; + format_run(s, &move |r| { + r.font = Some(f.clone()); + if let Some(v) = &ea { + r.font_ea = Some(v.clone()); + } + if let Some(v) = &cs { + r.font_cs = Some(v.clone()); + } + }) } pub(super) fn size(s: &mut Session, p: &Value) -> Result { diff --git a/crates/engine/src/cmd/text.rs b/crates/engine/src/cmd/text.rs index 6f85df870..d441e6421 100644 --- a/crates/engine/src/cmd/text.rs +++ b/crates/engine/src/cmd/text.rs @@ -186,3 +186,76 @@ pub(crate) fn edit_text(s: &mut Session, f: impl FnOnce(&mut TextBody, &mut T } Ok(r) } + +#[cfg(test)] +mod font_script_tests { + use super::*; + + /// Every run's (latin, east asian, complex script) typefaces in the deck. + fn typefaces(s: &mut Session) -> Vec<(Option, Option, Option)> { + s.doc() + .unwrap() + .doc + .slides + .iter() + .flat_map(|sl| sl.shapes.iter()) + .filter_map(|sh| sh.text.as_ref()) + .flat_map(|t| t.paragraphs.iter()) + .flat_map(|para| para.runs.iter()) + .map(|r| (r.props.font.clone(), r.props.font_ea.clone(), r.props.font_cs.clone())) + .collect() + } + + #[test] + fn format_font_sets_the_east_asian_and_complex_script_typefaces() { + // A run carries a typeface per script; setting only the Latin one leaves a CJK run + // drawing, and saving, in whatever `a:ea` named before (#786). + let mut s = Session::with_new(); + s.execute("slide.new", &json!({"layout": "blank"})).unwrap(); + s.execute("insert.textBox", &json!({"rect": [10, 10, 300, 50], "text": "Hello"})).unwrap(); + s.execute("text.exit", &json!({})).unwrap(); + + // All three at once. + s.execute("format.font", &json!({"family": "Lato", "eastAsia": "Noto Sans CJK SC", "complexScript": "Noto Sans Arabic"})).unwrap(); + assert_eq!(typefaces(&mut s), vec![(Some("Lato".into()), Some("Noto Sans CJK SC".into()), Some("Noto Sans Arabic".into()))]); + + // The Latin-only call keeps its old meaning: the other two are left alone, which is + // what makes the new parameters additive. + s.execute("format.font", &json!({"family": "Comic Neue"})).unwrap(); + assert_eq!(typefaces(&mut s), vec![(Some("Comic Neue".into()), Some("Noto Sans CJK SC".into()), Some("Noto Sans Arabic".into()))]); + + // And they reach the file: the issue is that a saved deck kept asking for the old + // East Asian font. + let bytes = crate::cmd::file::save_bytes(&s.doc().unwrap().doc, "pptx").unwrap(); + let mut zip = zip::ZipArchive::new(std::io::Cursor::new(&bytes)).unwrap(); + // The text box is on whichever slide was current, so look across all of them. + let mut xml = String::new(); + for i in 0..zip.len() { + let mut f = zip.by_index(i).unwrap(); + if f.name().starts_with("ppt/slides/slide") && f.name().ends_with(".xml") { + std::io::Read::read_to_string(&mut f, &mut xml).unwrap(); + } + } + assert!(xml.contains(r#""#), "no a:ea in the saved slides"); + assert!(xml.contains(r#""#), "no a:cs in the saved slides"); + assert!(xml.contains(r#""#), "no a:latin in the saved slides"); + + // Read back, they are still there. + s.execute("file.openBytes", &json!({"name": "f.pptx", "data": crate::cmd::base64_encode(&bytes)})).unwrap(); + assert_eq!(typefaces(&mut s), vec![(Some("Comic Neue".into()), Some("Noto Sans CJK SC".into()), Some("Noto Sans Arabic".into()))]); + } + + #[test] + fn format_font_rejects_an_unusable_typeface_name() { + let mut s = Session::with_new(); + s.execute("slide.new", &json!({"layout": "blank"})).unwrap(); + s.execute("insert.textBox", &json!({"rect": [10, 10, 300, 50], "text": "Hello"})).unwrap(); + s.execute("text.exit", &json!({})).unwrap(); + for p in [json!({"family": " "}), json!({"family": "Lato", "eastAsia": ""}), json!({"family": "Lato", "complexScript": "x".repeat(201)})] { + assert!(s.execute("format.font", &p).is_err(), "{p} should be rejected"); + } + // A name with spaces around it is kept, trimmed. + s.execute("format.font", &json!({"family": " Lato ", "eastAsia": " Noto Sans CJK SC "})).unwrap(); + assert_eq!(typefaces(&mut s), vec![(Some("Lato".into()), Some("Noto Sans CJK SC".into()), None)]); + } +} From 372c0e6c4445fd6aa029a8f11bfca1ec03124c87 Mon Sep 17 00:00:00 2001 From: Hamza Date: Thu, 29 Oct 2026 16:48:32 +0500 Subject: [PATCH 018/716] Apply only a date format the caller asked for The dialog always sends `dateText`, so an Apply with no format selection reached `set_date` carrying the deck's global format, and rewrote a slide's own date field to it. Measured on two slides, the first on the time format and the second on the short date: before [datetime11, datetime5] apply {"date": true, "dateText": "", "all": true} after [datetime5, datetime5] The first slide's format was never mentioned by the caller, and it was gone. `set_date` already keeps an existing field when the format is empty, so it now gets an empty format unless `dateFormat` was supplied; a format that is supplied still reaches every slide, which the test checks so the guard cannot quietly become a block. --- crates/engine/src/cmd/design/slide_setup.rs | 33 ++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/design/slide_setup.rs b/crates/engine/src/cmd/design/slide_setup.rs index 86d9317b7..ed91d3253 100644 --- a/crates/engine/src/cmd/design/slide_setup.rs +++ b/crates/engine/src/cmd/design/slide_setup.rs @@ -176,7 +176,12 @@ pub(super) fn header_footer(s: &mut Session, p: &Value) -> Result { } (Some(pos), true) if k == PhType::Date && (date_given || format_given) => { if let Some(sh) = sl.shapes.get_mut(pos) { - set_date(sh, &hf.date_text, &hf.date_format); + // Only a format the caller asked for. The dialog always sends + // `dateText`, so an Apply with no format selection reached here and + // rewrote a slide's own `datetime11` field to the deck's global + // format, which the caller never mentioned (noted in review). No + // format means the field keeps the one it has. + set_date(sh, &hf.date_text, if format_given { &hf.date_format } else { "" }); } } _ => {} @@ -298,6 +303,32 @@ mod header_footer_date_tests { got[0].0.clone() } + /// The dialog always sends `dateText`, so an Apply with no format selection reached + /// `set_date` with the deck's global format and rewrote a slide's own date field to it. The + /// format the caller did not mention is not a format the caller asked for (noted in review). + #[test] + fn an_apply_with_no_format_leaves_each_slides_own_format_alone() { + let mut s = Session::with_new(); + s.execute("slide.new", &json!({})).unwrap(); + s.execute("design.headerFooter", &json!({"date": true, "dateFormat": "datetime11", "all": true})).unwrap(); + let kinds = |s: &Session| dates(s).into_iter().map(|(_, k)| k).collect::>(); + assert_eq!(kinds(&s), vec![Some("datetime11".to_string()); 2], "both slides start on the time format"); + + // One slide alone takes a different format, which also becomes the deck's global one. + s.execute("design.headerFooter", &json!({"date": true, "dateFormat": "datetime5", "all": false})).unwrap(); + assert_eq!(kinds(&s), vec![Some("datetime11".to_string()), Some("datetime5".to_string())]); + assert_eq!(s.doc().unwrap().doc.header_footer.date_format, "datetime5"); + + // Apply with no `dateFormat`: the first slide keeps datetime11 rather than being rewritten + // to the global datetime5. + s.execute("design.headerFooter", &json!({"date": true, "dateText": "", "all": true})).unwrap(); + assert_eq!(kinds(&s), vec![Some("datetime11".to_string()), Some("datetime5".to_string())], "neither slide was rewritten"); + + // And a format that *is* given still reaches every slide, so the guard is not a block. + s.execute("design.headerFooter", &json!({"date": true, "dateFormat": "datetime2", "all": true})).unwrap(); + assert_eq!(kinds(&s), vec![Some("datetime2".to_string()); 2], "a format the caller asked for still applies"); + } + /// Header & Footer's automatic date takes the format it is given. `HeaderFooter::date_format` /// existed for this and was never read: the placeholder was always `datetime1`, and a /// `dateFormat` parameter was accepted and silently dropped. From 4c1916466b0aad6758c2889193adae8a7316116b Mon Sep 17 00:00:00 2001 From: DominicTheD3v <119626487+DominicTheD3v@users.noreply.github.com> Date: Fri, 30 Oct 2026 01:19:44 +0000 Subject: [PATCH 019/716] Allow resizing on all selected shapes --- crates/engine/src/tools.rs | 4 ++-- crates/engine/src/tools/drag.rs | 12 ++++++++---- crates/engine/src/tools/pointer.rs | 13 ++++++++----- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/crates/engine/src/tools.rs b/crates/engine/src/tools.rs index 78c6ed35c..19440fb33 100644 --- a/crates/engine/src/tools.rs +++ b/crates/engine/src/tools.rs @@ -149,9 +149,9 @@ enum Drag { enter_text: Option<(ShapeId, Point)>, }, Resize { - id: ShapeId, + ids: Vec, handle: u8, - orig: Xfrm, + origs: Vec<(ShapeId, Xfrm)>, start: Point, }, LineEnd { diff --git a/crates/engine/src/tools/drag.rs b/crates/engine/src/tools/drag.rs index 21aac4f38..5660a09a2 100644 --- a/crates/engine/src/tools/drag.rs +++ b/crates/engine/src/tools/drag.rs @@ -26,10 +26,14 @@ impl Session { Drag::Move { ids, start, origs, moved, duplicate, enter_text } => { return self.drag_move(MoveDrag { ids, start, origs, moved, duplicate, enter_text }, p, mods, tol); } - Drag::Resize { id, handle, orig, start } => { - let nx = resize_box(&orig, handle, p - start, mods.shift || self.is_picture(id), mods.alt); - let nx = self.snap_resize(nx, &orig, handle, id, tol); - self.set_xfrm(id, nx)?; + Drag::Resize { ids, handle, origs, start } => { + if ids.len() >= 1 { + for (id, o) in &origs { + let nx = resize_box(&o, handle, p - start, mods.shift || self.is_picture(*id), mods.alt); + let nx = self.snap_resize(nx, &o, handle, *id, tol); + self.set_xfrm(*id, nx)?; + } + } } Drag::LineEnd { id, end, orig } => { let a = orig.affine(); diff --git a/crates/engine/src/tools/pointer.rs b/crates/engine/src/tools/pointer.rs index bee8f3203..0a3999705 100644 --- a/crates/engine/src/tools/pointer.rs +++ b/crates/engine/src/tools/pointer.rs @@ -302,9 +302,10 @@ impl Session { Some(Hit::TableColumn { id, col }) => self.begin_table_border(id, true, col, p)?, Some(Hit::TableRow { id, row }) => self.begin_table_border(id, false, row, p)?, Some(Hit::Resize { id, handle }) => { - let orig = st.shape(id).map(|s| xfrm_of(&st.doc, &st.selection, s)).unwrap_or_default(); + let ids: Vec = if st.selection.shapes.contains(&id) { st.selection.shapes.clone() } else { vec![id] }; + let origs: Vec<(ShapeId, Xfrm)> = ids.iter().filter_map(|i| st.shape(*i).map(|s| (*i, xfrm_of(&st.doc, &st.selection, s)))).collect(); self.begin("Size"); - self.tool.drag = Some(Drag::Resize { id, handle, orig, start: p }); + self.tool.drag = Some(Drag::Resize { ids, handle, origs, start: p }); } Some(Hit::LineEnd { id, end }) => { let orig = st.shape(id).map(|s| xfrm_of(&st.doc, &st.selection, s)).unwrap_or_default(); @@ -559,10 +560,12 @@ impl Session { out = self.add_ink(points)?; } } - Some(Drag::Resize { id, .. }) => { + Some(Drag::Resize { ids, .. }) => { self.commit(); - let _ = cmd::text::fit_text_box(self, id); - self.refit_after_resize(id)?; + for id in ids { + let _ = cmd::text::fit_text_box(self, id); + self.refit_after_resize(id)?; + } } Some(Drag::TextSelect { before, .. }) => { out = self.paint_if_selection_changed(before, out)?; From 32ef926c46d3b6312aaecfcc0870e14bb1e49c0e Mon Sep 17 00:00:00 2001 From: DominicTheD3v <119626487+DominicTheD3v@users.noreply.github.com> Date: Fri, 30 Oct 2026 01:46:06 +0000 Subject: [PATCH 020/716] fix: address CodeRabbit review findings --- crates/engine/src/tools/pointer.rs | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/crates/engine/src/tools/pointer.rs b/crates/engine/src/tools/pointer.rs index 0a3999705..50d11c39f 100644 --- a/crates/engine/src/tools/pointer.rs +++ b/crates/engine/src/tools/pointer.rs @@ -303,7 +303,8 @@ impl Session { Some(Hit::TableRow { id, row }) => self.begin_table_border(id, false, row, p)?, Some(Hit::Resize { id, handle }) => { let ids: Vec = if st.selection.shapes.contains(&id) { st.selection.shapes.clone() } else { vec![id] }; - let origs: Vec<(ShapeId, Xfrm)> = ids.iter().filter_map(|i| st.shape(*i).map(|s| (*i, xfrm_of(&st.doc, &st.selection, s)))).collect(); + let origs: Vec<(ShapeId, Xfrm)> = ids.iter().filter_map(|i| {st.shape(*i).filter(|s| !s.locked).map(|s| (*i, xfrm_of(&st.doc, &st.selection, s)))}).collect(); + let ids: Vec = origs.iter().map(|(id, _)| *id).collect(); self.begin("Size"); self.tool.drag = Some(Drag::Resize { ids, handle, origs, start: p }); } @@ -560,12 +561,24 @@ impl Session { out = self.add_ink(points)?; } } - Some(Drag::Resize { ids, .. }) => { - self.commit(); - for id in ids { - let _ = cmd::text::fit_text_box(self, id); - self.refit_after_resize(id)?; + Some(Drag::Resize { origs, .. }) => { + let changed: Vec = origs.iter() + .filter_map(|(id, orig)| { + let current = self.active() + .and_then(|st| st.shape(*id).map(|s| { + xfrm_of(&st.doc, &st.selection, s) + }))?; + + (current != *orig).then_some(*id) + }) + .collect(); + if !changed.is_empty() { + for id in changed { + let _ = cmd::text::fit_text_box(self, id); + self.refit_after_resize(id)?; + } } + self.commit(); } Some(Drag::TextSelect { before, .. }) => { out = self.paint_if_selection_changed(before, out)?; From 93caf4d222207781c8eef57217cd05bc5b95b090 Mon Sep 17 00:00:00 2001 From: MarekSpodBiedry <73122968+MarekSpodBiedry@users.noreply.github.com> Date: Fri, 30 Oct 2026 16:37:27 +0100 Subject: [PATCH 021/716] Paste copied shapes while a text box is being edited (#1550) --- crates/engine/src/cmd/edit.rs | 3 ++- crates/engine/src/tests.rs | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index b098503ca..725808e4d 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -278,7 +278,8 @@ fn paste(s: &mut Session, p: &Value) -> Result { return paste_plain(s, t); } let editing = s.doc()?.selection.text.is_some(); - if editing { + // Copied shapes are pasted as shapes even while a text box is being edited (the caret leaves it). + if editing && (s.clipboard.text.is_some() || s.clipboard.shapes.is_empty()) { if let Some(body) = s.clipboard.text.clone() { return super::text::paste_body(s, &body); } diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 4dfc21f45..6692ee155 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -214,6 +214,20 @@ fn clipboard_copy_paste_shapes_and_slides() { assert!(s.doc().unwrap().doc.validate().is_empty()); } +#[test] +fn copied_shapes_paste_as_shapes_while_a_text_box_is_being_edited() { + let mut s = session(); + s.execute("shape.insert", &json!({"preset": "ellipse", "rect": [10, 10, 50, 50]})).unwrap(); + s.execute("edit.copy", &json!({})).unwrap(); + let r = s.execute("insert.textBox", &json!({"text": "Hello"})).unwrap(); + let id = r["id"].as_u64().unwrap(); + s.execute("text.edit", &json!({"id": id})).unwrap(); + let before = s.doc().unwrap().current_slide().unwrap().shapes.len(); + s.execute("edit.paste", &json!({})).unwrap(); + assert_eq!(s.doc().unwrap().current_slide().unwrap().shapes.len(), before + 1); + assert!(s.doc().unwrap().selection.text.is_none()); +} + #[test] fn pasted_shapes_get_the_next_automatic_name() { let mut s = session(); From d403e047cf88200a6abd7424ba2daba30ca61949 Mon Sep 17 00:00:00 2001 From: Harrison Booth <73434116+Harrison-Booth@users.noreply.github.com> Date: Fri, 30 Oct 2026 14:22:02 -0500 Subject: [PATCH 022/716] docs: preserve optional local session context --- CLAUDE.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 1f8193103..88256c23a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -8,9 +8,10 @@ New workspace crates must include `[lints] workspace = true` in `Cargo.toml` to before modules or other crate items; crate-level `//!` documentation may precede them. ## Start every session -1. Read `ROADMAP.md` and `docs/roadmap.md`. -2. Read `../../craftrules/AGENTS.md` and the standards it lists for your task. -3. Run `cargo xtask ci` before you change anything, so you know the tree is green. +1. Read `plan/STATUS.md` when it exists. +2. Read `ROADMAP.md` and `docs/roadmap.md`. +3. Read `../../craftrules/AGENTS.md` and the standards it lists for your task. +4. Run `cargo xtask ci` before you change anything, so you know the tree is green. ## Habits - Every user-visible action is a command with tests (`crates/engine/src/cmd/*`). From 5529c695bf04b6149019c0964a2cd72fe1164151 Mon Sep 17 00:00:00 2001 From: Harrison Booth <73434116+Harrison-Booth@users.noreply.github.com> Date: Fri, 30 Oct 2026 14:32:09 -0500 Subject: [PATCH 023/716] docs: complete module split path mappings --- docs/module-split-map.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/module-split-map.md b/docs/module-split-map.md index 7ee0f7ce1..e56464c52 100644 --- a/docs/module-split-map.md +++ b/docs/module-split-map.md @@ -16,8 +16,9 @@ To find the exact new home of one function: `git grep -n 'fn name' origin/main - | `engine/src/cmd/mod.rs` | `engine/src/cmd.rs` | | `opus/src/celt/mod.rs`, `opus/src/silk/mod.rs` | `opus/src/celt.rs`, `opus/src/silk.rs` | | `pptx/src/read/mod.rs`, `pptx/src/write/mod.rs` | `pptx/src/read.rs`, `pptx/src/write.rs` | +| `ui-egui/src/selpane.rs` | `ui-egui/src/panels/selpane.rs` | | `ui-egui/src/backstage_tests.rs` | `ui-egui/src/backstage/tests.rs` | -| `ui-egui/src/selpane_tests.rs`, `sorter_tests.rs` | `ui-egui/src/panels/selpane/ui_tests.rs`, `ui-egui/src/sorter/ui_tests.rs` | +| `ui-egui/src/selpane_tests.rs`, `ui-egui/src/sorter_tests.rs` | `ui-egui/src/panels/selpane/ui_tests.rs`, `ui-egui/src/sorter/ui_tests.rs` | `ui-egui/src` files moved into a folder: `guides_tests`, `preview`, `ruler_tests`, `squiggles` → `canvas/`; `columns_dialog_tests`, `credits`, `font_dialog_tests`, `paragraph_dialog_tests`, From 6303166a1816693d7dfa7b04263cee61daf062fa Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Mon, 19 Oct 2026 02:58:27 -0500 Subject: [PATCH 024/716] [PP1] show.setup showMediaControls survives a pptx save and reopen PowerPoint stores Show media controls as the p14:showMediaCtrls extension inside p:showPr (uri {2FDB2607-...}); absent means shown. Write it when hidden, read it back. Co-Authored-By: Claude Sonnet 5.5 --- crates/pptx/src/read.rs | 1 + crates/pptx/src/write.rs | 8 ++++++++ crates/pptx/tests/it/roundtrip.rs | 9 +++++++++ 3 files changed, 18 insertions(+) diff --git a/crates/pptx/src/read.rs b/crates/pptx/src/read.rs index 917aa9277..2df349cb7 100644 --- a/crates/pptx/src/read.rs +++ b/crates/pptx/src/read.rs @@ -1283,6 +1283,7 @@ fn read_show(sp: &El, shows: &HashMap) -> ShowSettings { without_narration: sp.bool("showNarration") == Some(false), without_animation: sp.bool("showAnimation") == Some(false), use_timings: sp.bool("useTimings").unwrap_or(true), + show_media_controls: sp.find("showMediaCtrls").and_then(|e| e.bool("val")).unwrap_or(true), ..Default::default() }; if sp.child("browse").is_some() { diff --git a/crates/pptx/src/write.rs b/crates/pptx/src/write.rs index 5d3e60e92..37cf5cd7d 100644 --- a/crates/pptx/src/write.rs +++ b/crates/pptx/src/write.rs @@ -1181,6 +1181,14 @@ fn pres_props_xml(p: &Presentation) -> Vec { w.open0("p:penClr"); w.val("a:srgbClr", s.pen_color.hex()); w.close("p:penClr"); + if !s.show_media_controls { + // "Show media controls" is PowerPoint's p14 extension; absent means shown. + w.open0("p:extLst"); + w.open("p:ext", A::new().a("uri", "{2FDB2607-1784-4EEB-B798-7EB5836EED8A}")); + w.empty("p14:showMediaCtrls", A::new().a("xmlns:p14", NS_P14).a("val", 0)); + w.close("p:ext"); + w.close("p:extLst"); + } w.close("p:showPr"); w.close("p:presentationPr"); w.finish() diff --git a/crates/pptx/tests/it/roundtrip.rs b/crates/pptx/tests/it/roundtrip.rs index 370cc9a9f..c61e6e433 100644 --- a/crates/pptx/tests/it/roundtrip.rs +++ b/crates/pptx/tests/it/roundtrip.rs @@ -1969,3 +1969,12 @@ fn default_durations_match_powerpoint() { assert_eq!(a.4, ms, "{effect}"); } } + +/// Show media controls is PowerPoint's `p14:showMediaCtrls` extension inside `p:showPr`. +#[test] +fn hidden_media_controls_survive_save_and_reopen() { + let mut p = Presentation::default(); + p.show.show_media_controls = false; + assert!(!round(&p).show.show_media_controls); + assert!(round(&Presentation::default()).show.show_media_controls); +} From 82adf7326e1e6be4770499e2bef3495091d19ee2 Mon Sep 17 00:00:00 2001 From: DominicTheD3v <119626487+DominicTheD3v@users.noreply.github.com> Date: Fri, 30 Oct 2026 21:13:44 +0000 Subject: [PATCH 025/716] fix: address raised issues --- crates/engine/src/tests.rs | 132 ++++++++++++++++++++++++++++ crates/engine/src/tools/drag.rs | 10 +-- crates/engine/src/tools/geometry.rs | 4 +- crates/engine/src/tools/pointer.rs | 11 ++- 4 files changed, 143 insertions(+), 14 deletions(-) diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 4dfc21f45..b72dcbd7d 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -5479,6 +5479,138 @@ fn box_of(s: &mut Session, id: u64) -> serde_json::Value { s.execute("shape.inspect", &json!({"id": id})).unwrap()["box"].clone() } +/// Two selected boxes with different sizes and aligned right edges, on a blank slide. +fn resize_selection_scene() -> (Session, [u64; 2]) { + let mut s = session(); + s.execute("slide.new", &json!({"layout": "blank"})).unwrap(); + s.prefs.smart_guides = false; + s.prefs.snap_to_grid = false; + let ids = [[100, 100, 100, 80], [120, 300, 80, 100]] + .map(|rect| s.execute("shape.insert", &json!({"preset": "rect", "rect": rect, "text": "Resize test"})).unwrap()["id"].as_u64().unwrap()); + s.execute("edit.select", &json!({"ids": ids})).unwrap(); + (s, ids) +} + +/// Simulate file-loaded shapes whose stored boxes have not yet been fitted to their text. +fn pending_resize_autofit(s: &mut Session, ids: &[u64]) { + s.edit(|doc, sel| { + let shapes = crate::shapes_mut(doc, sel).unwrap(); + for id in ids { + let sh = deckcraft_model::find_shape_mut(shapes, ShapeId(*id as u32)).unwrap(); + sh.text.as_mut().unwrap().body.autofit = Some(deckcraft_model::text::AutoFit::Shape); + } + Ok(()) + }) + .unwrap(); +} + +#[test] +fn resizing_selected_shapes_is_one_undo_step() { + let (mut s, [a, b]) = resize_selection_scene(); + let before = s.doc().unwrap().doc.clone(); + let steps = s.doc().unwrap().history.undo.len(); + let down = drag_gesture(&mut s, (200.0, 180.0), (250.0, 210.0)); + assert_eq!(down["hit"]["kind"], "resize"); + assert_eq!(down["hit"]["id"], a); + for (id, expected) in [(a, [100.0, 100.0, 150.0, 110.0]), (b, [120.0, 300.0, 130.0, 130.0])] { + let actual = box_of(&mut s, id); + for (key, value) in ["x", "y", "w", "h"].into_iter().zip(expected) { + assert_eq!(actual[key], value, "{id}: {key}"); + } + } + assert_eq!(s.doc().unwrap().history.undo.len(), steps + 1); + let after = s.doc().unwrap().doc.clone(); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(s.doc().unwrap().doc, before, "one undo restores both shapes"); + s.execute("edit.redo", &json!({})).unwrap(); + assert_eq!(s.doc().unwrap().doc, after, "one redo resizes both shapes again"); +} + +#[test] +fn resizing_selected_shapes_refits_text_in_the_same_undo_step() { + let (mut s, ids) = resize_selection_scene(); + pending_resize_autofit(&mut s, &ids); + let before = s.doc().unwrap().doc.clone(); + let steps = s.doc().unwrap().history.undo.len(); + // An east-handle drag changes width only; a height change must come from text fitting. + drag_gesture(&mut s, (200.0, 140.0), (250.0, 140.0)); + for (id, old_height) in ids.into_iter().zip([80.0, 100.0]) { + assert_ne!(box_of(&mut s, id)["h"], old_height, "both shapes' text is refitted"); + } + assert_eq!(s.doc().unwrap().history.undo.len(), steps + 1); + let after = s.doc().unwrap().doc.clone(); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(s.doc().unwrap().doc, before); + s.execute("edit.redo", &json!({})).unwrap(); + assert_eq!(s.doc().unwrap().doc, after, "redo includes the final text fit"); +} + +#[test] +fn clicking_a_resize_handle_does_not_change_or_refit_selected_shapes() { + let (mut s, ids) = resize_selection_scene(); + pending_resize_autofit(&mut s, &ids); + let before = s.doc().unwrap().doc.clone(); + let steps = s.doc().unwrap().history.undo.len(); + let revision = s.doc().unwrap().revision; + for kind in [PointerKind::Down, PointerKind::Up] { + s.pointer(PointerEvent { kind, x: 200.0, y: 180.0, tol: 3.0, ..Default::default() }).unwrap(); + } + assert_eq!(s.doc().unwrap().doc, before); + assert_eq!(s.doc().unwrap().history.undo.len(), steps, "a click creates no undo entry"); + assert_eq!(s.doc().unwrap().revision, revision); + assert!(std::sync::Arc::ptr_eq(&s.doc().unwrap().doc, &before), "a click does not dirty the document"); + // Ensure this fixture would catch an accidental refit on release. + for id in ids { + cmd::text::fit_text_box(&mut s, ShapeId(id as u32)).unwrap(); + } + assert_ne!(s.doc().unwrap().doc, before); +} + +#[test] +fn resizing_selected_shapes_skips_locked_shapes_and_their_text_fit() { + let (mut s, [a, b]) = resize_selection_scene(); + pending_resize_autofit(&mut s, &[b]); + s.execute("shape.lock", &json!({"ids": [b], "locked": true})).unwrap(); + s.execute("edit.select", &json!({"ids": [a, b]})).unwrap(); + let locked = s.doc().unwrap().shape(ShapeId(b as u32)).unwrap().clone(); + let before = s.doc().unwrap().doc.clone(); + let steps = s.doc().unwrap().history.undo.len(); + drag_gesture(&mut s, (200.0, 180.0), (250.0, 210.0)); + assert_eq!(box_of(&mut s, a)["w"], 150.0); + assert_eq!(box_of(&mut s, a)["h"], 110.0); + assert_eq!(s.doc().unwrap().shape(ShapeId(b as u32)).unwrap(), &locked, "the locked shape is neither resized nor refitted"); + assert_eq!(s.doc().unwrap().history.undo.len(), steps + 1); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(s.doc().unwrap().doc, before); +} + +#[test] +fn resizing_selected_shapes_does_not_snap_to_other_resize_targets() { + for reverse in [false, true] { + let (mut s, [a, b]) = resize_selection_scene(); + s.prefs.smart_guides = true; + let ids = if reverse { [b, a] } else { [a, b] }; + s.execute("edit.select", &json!({"ids": ids})).unwrap(); + // Within snap tolerance of the other selected shape's original right edge. + drag_gesture(&mut s, (200.0, 140.0), (203.0, 140.0)); + assert_eq!(box_of(&mut s, a)["w"], 103.0, "first shape must not snap back"); + assert_eq!(box_of(&mut s, b)["w"], 83.0, "selection order must not affect snapping"); + } +} + +#[test] +fn resizing_selected_shapes_still_snaps_to_stationary_shapes() { + let (mut s, [a, b]) = resize_selection_scene(); + let fixed = s.execute("shape.insert", &json!({"preset": "rect", "rect": [207, 430, 100, 80]})).unwrap()["id"].as_u64().unwrap(); + let fixed_before = box_of(&mut s, fixed); + s.execute("edit.select", &json!({"ids": [a, b]})).unwrap(); + s.prefs.smart_guides = true; + drag_gesture(&mut s, (200.0, 140.0), (203.0, 140.0)); + assert_eq!(box_of(&mut s, a)["w"], 107.0); + assert_eq!(box_of(&mut s, b)["w"], 87.0); + assert_eq!(box_of(&mut s, fixed), fixed_before); +} + /// #961: dragging the east handle snaps the dragged (right) edge, even when the fixed left edge /// already lines up with another shape. The nearest line used to be the fixed edge's, at distance 0. #[test] diff --git a/crates/engine/src/tools/drag.rs b/crates/engine/src/tools/drag.rs index 5660a09a2..7dca38225 100644 --- a/crates/engine/src/tools/drag.rs +++ b/crates/engine/src/tools/drag.rs @@ -27,12 +27,10 @@ impl Session { return self.drag_move(MoveDrag { ids, start, origs, moved, duplicate, enter_text }, p, mods, tol); } Drag::Resize { ids, handle, origs, start } => { - if ids.len() >= 1 { - for (id, o) in &origs { - let nx = resize_box(&o, handle, p - start, mods.shift || self.is_picture(*id), mods.alt); - let nx = self.snap_resize(nx, &o, handle, *id, tol); - self.set_xfrm(*id, nx)?; - } + for (id, o) in &origs { + let nx = resize_box(o, handle, p - start, mods.shift || self.is_picture(*id), mods.alt); + let nx = self.snap_resize(nx, handle, &ids, tol); + self.set_xfrm(*id, nx)?; } } Drag::LineEnd { id, end, orig } => { diff --git a/crates/engine/src/tools/geometry.rs b/crates/engine/src/tools/geometry.rs index 536a4ead2..cbbd01275 100644 --- a/crates/engine/src/tools/geometry.rs +++ b/crates/engine/src/tools/geometry.rs @@ -228,7 +228,7 @@ impl Session { } /// Snap the edges that resize handle `handle` drags in the resized box `x` to the smart guides. - pub(super) fn snap_resize(&mut self, x: Xfrm, _orig: &Xfrm, handle: u8, id: ShapeId, tol: f64) -> Xfrm { + pub(super) fn snap_resize(&mut self, x: Xfrm, handle: u8, exclude: &[ShapeId], tol: f64) -> Xfrm { if x.rot != 0.0 { self.tool.guides.clear(); return x; @@ -241,7 +241,7 @@ impl Session { let (top, bottom) = (matches!(handle, 0..=2), matches!(handle, 4..=6)); let (moves_left, moves_right) = if x.flip_h { (right, left) } else { (left, right) }; let (moves_top, moves_bottom) = if x.flip_v { (bottom, top) } else { (top, bottom) }; - let (off, guides) = self.snap_edges(r, &[id], tol * 1.5, true, [moves_left, false, moves_right], [moves_top, false, moves_bottom]); + let (off, guides) = self.snap_edges(r, exclude, tol * 1.5, true, [moves_left, false, moves_right], [moves_top, false, moves_bottom]); let mut nx = x; if moves_left { nx.x += off.x; diff --git a/crates/engine/src/tools/pointer.rs b/crates/engine/src/tools/pointer.rs index 50d11c39f..dbaf495f8 100644 --- a/crates/engine/src/tools/pointer.rs +++ b/crates/engine/src/tools/pointer.rs @@ -303,7 +303,8 @@ impl Session { Some(Hit::TableRow { id, row }) => self.begin_table_border(id, false, row, p)?, Some(Hit::Resize { id, handle }) => { let ids: Vec = if st.selection.shapes.contains(&id) { st.selection.shapes.clone() } else { vec![id] }; - let origs: Vec<(ShapeId, Xfrm)> = ids.iter().filter_map(|i| {st.shape(*i).filter(|s| !s.locked).map(|s| (*i, xfrm_of(&st.doc, &st.selection, s)))}).collect(); + let origs: Vec<(ShapeId, Xfrm)> = + ids.iter().filter_map(|i| st.shape(*i).filter(|s| !s.locked).map(|s| (*i, xfrm_of(&st.doc, &st.selection, s)))).collect(); let ids: Vec = origs.iter().map(|(id, _)| *id).collect(); self.begin("Size"); self.tool.drag = Some(Drag::Resize { ids, handle, origs, start: p }); @@ -562,12 +563,10 @@ impl Session { } } Some(Drag::Resize { origs, .. }) => { - let changed: Vec = origs.iter() + let changed: Vec = origs + .iter() .filter_map(|(id, orig)| { - let current = self.active() - .and_then(|st| st.shape(*id).map(|s| { - xfrm_of(&st.doc, &st.selection, s) - }))?; + let current = self.active().and_then(|st| st.shape(*id).map(|s| xfrm_of(&st.doc, &st.selection, s)))?; (current != *orig).then_some(*id) }) From e812da58df5b2d1c268b6674c6b10dbee67ce8ce Mon Sep 17 00:00:00 2001 From: DominicTheD3v <119626487+DominicTheD3v@users.noreply.github.com> Date: Fri, 30 Oct 2026 22:51:33 +0000 Subject: [PATCH 026/716] fix: addressing issues --- crates/engine/src/tests.rs | 12 ++++++++--- crates/engine/src/tools.rs | 2 ++ crates/engine/src/tools/drag.rs | 33 +++++++++++++++++++++++++----- crates/engine/src/tools/pointer.rs | 3 ++- 4 files changed, 41 insertions(+), 9 deletions(-) diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index b72dcbd7d..ef18a31f6 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -5504,6 +5504,7 @@ fn pending_resize_autofit(s: &mut Session, ids: &[u64]) { .unwrap(); } +/// Resizing multiple selected shapes scales them proportionally around their anchors in one undo step. #[test] fn resizing_selected_shapes_is_one_undo_step() { let (mut s, [a, b]) = resize_selection_scene(); @@ -5512,7 +5513,7 @@ fn resizing_selected_shapes_is_one_undo_step() { let down = drag_gesture(&mut s, (200.0, 180.0), (250.0, 210.0)); assert_eq!(down["hit"]["kind"], "resize"); assert_eq!(down["hit"]["id"], a); - for (id, expected) in [(a, [100.0, 100.0, 150.0, 110.0]), (b, [120.0, 300.0, 130.0, 130.0])] { + for (id, expected) in [(a, [100.0, 100.0, 150.0, 110.0]), (b, [120.0, 300.0, 120.0, 137.5])] { let actual = box_of(&mut s, id); for (key, value) in ["x", "y", "w", "h"].into_iter().zip(expected) { assert_eq!(actual[key], value, "{id}: {key}"); @@ -5526,6 +5527,7 @@ fn resizing_selected_shapes_is_one_undo_step() { assert_eq!(s.doc().unwrap().doc, after, "one redo resizes both shapes again"); } +/// Resizing selected shapes refits their text boxes inside the same undo transaction. #[test] fn resizing_selected_shapes_refits_text_in_the_same_undo_step() { let (mut s, ids) = resize_selection_scene(); @@ -5545,6 +5547,7 @@ fn resizing_selected_shapes_refits_text_in_the_same_undo_step() { assert_eq!(s.doc().unwrap().doc, after, "redo includes the final text fit"); } +/// Clicking a resize handle without dragging neither modifies shapes nor triggers text autofit. #[test] fn clicking_a_resize_handle_does_not_change_or_refit_selected_shapes() { let (mut s, ids) = resize_selection_scene(); @@ -5566,6 +5569,7 @@ fn clicking_a_resize_handle_does_not_change_or_refit_selected_shapes() { assert_ne!(s.doc().unwrap().doc, before); } +/// Locked shapes in a multi-selection are excluded from both resizing and post-resize text fitting. #[test] fn resizing_selected_shapes_skips_locked_shapes_and_their_text_fit() { let (mut s, [a, b]) = resize_selection_scene(); @@ -5584,6 +5588,7 @@ fn resizing_selected_shapes_skips_locked_shapes_and_their_text_fit() { assert_eq!(s.doc().unwrap().doc, before); } +/// Resizing selected shapes excludes other selected resize targets from smart-guide snapping. #[test] fn resizing_selected_shapes_does_not_snap_to_other_resize_targets() { for reverse in [false, true] { @@ -5594,10 +5599,11 @@ fn resizing_selected_shapes_does_not_snap_to_other_resize_targets() { // Within snap tolerance of the other selected shape's original right edge. drag_gesture(&mut s, (200.0, 140.0), (203.0, 140.0)); assert_eq!(box_of(&mut s, a)["w"], 103.0, "first shape must not snap back"); - assert_eq!(box_of(&mut s, b)["w"], 83.0, "selection order must not affect snapping"); + assert_eq!(box_of(&mut s, b)["w"], 82.4, "selection order must not affect snapping"); } } +/// Resizing selected shapes snaps the active shape against unselected stationary shapes and scales others proportionally. #[test] fn resizing_selected_shapes_still_snaps_to_stationary_shapes() { let (mut s, [a, b]) = resize_selection_scene(); @@ -5607,7 +5613,7 @@ fn resizing_selected_shapes_still_snaps_to_stationary_shapes() { s.prefs.smart_guides = true; drag_gesture(&mut s, (200.0, 140.0), (203.0, 140.0)); assert_eq!(box_of(&mut s, a)["w"], 107.0); - assert_eq!(box_of(&mut s, b)["w"], 87.0); + assert!((box_of(&mut s, b)["w"].as_f64().unwrap() - 85.6).abs() < 1e-9); assert_eq!(box_of(&mut s, fixed), fixed_before); } diff --git a/crates/engine/src/tools.rs b/crates/engine/src/tools.rs index 19440fb33..82f53dfc3 100644 --- a/crates/engine/src/tools.rs +++ b/crates/engine/src/tools.rs @@ -149,6 +149,8 @@ enum Drag { enter_text: Option<(ShapeId, Point)>, }, Resize { + id: ShapeId, + orig: Xfrm, ids: Vec, handle: u8, origs: Vec<(ShapeId, Xfrm)>, diff --git a/crates/engine/src/tools/drag.rs b/crates/engine/src/tools/drag.rs index 7dca38225..367e6b856 100644 --- a/crates/engine/src/tools/drag.rs +++ b/crates/engine/src/tools/drag.rs @@ -26,11 +26,34 @@ impl Session { Drag::Move { ids, start, origs, moved, duplicate, enter_text } => { return self.drag_move(MoveDrag { ids, start, origs, moved, duplicate, enter_text }, p, mods, tol); } - Drag::Resize { ids, handle, origs, start } => { - for (id, o) in &origs { - let nx = resize_box(o, handle, p - start, mods.shift || self.is_picture(*id), mods.alt); - let nx = self.snap_resize(nx, handle, &ids, tol); - self.set_xfrm(*id, nx)?; + Drag::Resize { id, orig, ids, handle, origs, start } => { + let nx = resize_box(&orig, handle, p - start, mods.shift || self.is_picture(id), mods.alt); + let nx = self.snap_resize(nx, handle, &ids, tol); + let sx = if orig.w > 1e-9 { (nx.w / orig.w) * if nx.flip_h != orig.flip_h { -1.0 } else { 1.0 } - 1.0 } else { 0.0 }; + let sy = if orig.h > 1e-9 { (nx.h / orig.h) * if nx.flip_v != orig.flip_v { -1.0 } else { 1.0 } - 1.0 } else { 0.0 }; + let div = if mods.alt { 2.0 } else { 1.0 }; + let hx = match handle { + 0 | 6 | 7 => -1.0, + 2..=4 => 1.0, + _ => 0.0, + }; + let hy = match handle { + 0..=2 => -1.0, + 4..=6 => 1.0, + _ => 0.0, + }; + for (tid, o) in &origs { + let target_nx = if *tid == id { + nx + } else { + let lp = Affine::rotate(o.rot.to_radians()) + * Point::new( + hx * sx * o.w / div * if o.flip_h { -1.0 } else { 1.0 }, + hy * sy * o.h / div * if o.flip_v { -1.0 } else { 1.0 }, + ); + resize_box(o, handle, Vec2::new(lp.x, lp.y), mods.shift || self.is_picture(*tid), mods.alt) + }; + self.set_xfrm(*tid, target_nx)?; } } Drag::LineEnd { id, end, orig } => { diff --git a/crates/engine/src/tools/pointer.rs b/crates/engine/src/tools/pointer.rs index dbaf495f8..1f4cba0c5 100644 --- a/crates/engine/src/tools/pointer.rs +++ b/crates/engine/src/tools/pointer.rs @@ -302,12 +302,13 @@ impl Session { Some(Hit::TableColumn { id, col }) => self.begin_table_border(id, true, col, p)?, Some(Hit::TableRow { id, row }) => self.begin_table_border(id, false, row, p)?, Some(Hit::Resize { id, handle }) => { + let orig = st.shape(id).map(|s| xfrm_of(&st.doc, &st.selection, s)).unwrap_or_default(); let ids: Vec = if st.selection.shapes.contains(&id) { st.selection.shapes.clone() } else { vec![id] }; let origs: Vec<(ShapeId, Xfrm)> = ids.iter().filter_map(|i| st.shape(*i).filter(|s| !s.locked).map(|s| (*i, xfrm_of(&st.doc, &st.selection, s)))).collect(); let ids: Vec = origs.iter().map(|(id, _)| *id).collect(); self.begin("Size"); - self.tool.drag = Some(Drag::Resize { ids, handle, origs, start: p }); + self.tool.drag = Some(Drag::Resize { id, orig, ids, handle, origs, start: p }); } Some(Hit::LineEnd { id, end }) => { let orig = st.shape(id).map(|s| xfrm_of(&st.doc, &st.selection, s)).unwrap_or_default(); From 09bbfc72176af42ae586795367caec9dd5e8db77 Mon Sep 17 00:00:00 2001 From: DominicTheD3v <119626487+DominicTheD3v@users.noreply.github.com> Date: Fri, 30 Oct 2026 23:25:01 +0000 Subject: [PATCH 027/716] fix: addressing issues raised by coderabbit --- crates/engine/src/tools/drag.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/tools/drag.rs b/crates/engine/src/tools/drag.rs index 367e6b856..24f0ae978 100644 --- a/crates/engine/src/tools/drag.rs +++ b/crates/engine/src/tools/drag.rs @@ -27,7 +27,11 @@ impl Session { return self.drag_move(MoveDrag { ids, start, origs, moved, duplicate, enter_text }, p, mods, tol); } Drag::Resize { id, orig, ids, handle, origs, start } => { - let nx = resize_box(&orig, handle, p - start, mods.shift || self.is_picture(id), mods.alt); + if orig.w <= 0.0 || orig.h <= 0.0 { + return Ok(Value::Null); + } + let keep_aspect = mods.shift || self.is_picture(id); + let nx = resize_box(&orig, handle, p - start, keep_aspect, mods.alt); let nx = self.snap_resize(nx, handle, &ids, tol); let sx = if orig.w > 1e-9 { (nx.w / orig.w) * if nx.flip_h != orig.flip_h { -1.0 } else { 1.0 } - 1.0 } else { 0.0 }; let sy = if orig.h > 1e-9 { (nx.h / orig.h) * if nx.flip_v != orig.flip_v { -1.0 } else { 1.0 } - 1.0 } else { 0.0 }; @@ -51,7 +55,7 @@ impl Session { hx * sx * o.w / div * if o.flip_h { -1.0 } else { 1.0 }, hy * sy * o.h / div * if o.flip_v { -1.0 } else { 1.0 }, ); - resize_box(o, handle, Vec2::new(lp.x, lp.y), mods.shift || self.is_picture(*tid), mods.alt) + resize_box(o, handle, Vec2::new(lp.x, lp.y), keep_aspect, mods.alt) }; self.set_xfrm(*tid, target_nx)?; } From d453bee54f4dc0810e07b97ead32fa5c6c19b7d9 Mon Sep 17 00:00:00 2001 From: Harrison Booth <73434116+Harrison-Booth@users.noreply.github.com> Date: Fri, 30 Oct 2026 18:57:51 -0500 Subject: [PATCH 028/716] D604: readable animation effect labels --- ROADMAP.md | 3 + crates/ui-egui/src/ribbon/animations.rs | 89 ++++++++++++++++++++++++- docs/animation-parity.md | 5 +- docs/gaps.md | 4 +- 4 files changed, 96 insertions(+), 5 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index a99369256..5a31b3bdf 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,6 +2,7 @@ **Stage: alpha** · next: beta, ~20 points and ~120–210 h away +> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-30 · **Change:** trivial (progress log: animation Effect Options show readable labels; stage and scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-27 · **Change:** trivial (progress log: Set Up Slide Show ▸ Keep mouse cursor visible, #1445; stage and scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-26 · **Change:** trivial (progress log: dragging several selected slides moves them all; previous: trivial, progress log: Edit Points handle drags with Shift, Ctrl/Cmd or Alt/Option set the point type; previous: trivial, progress log: scroll bars on the zoomed slide pane, #1157; previous: minor, native chart payloads stored in bounded ZIP members; previous: major, community PR wave 2026-10-14: ~60 landed items in the progress log, among them the Font, Paragraph, Photo Album, theme colour and font and Date and Time dialogs, presenter and show controls, the SmartArt Text Pane and PPTX corpus slices; breadth 84% after `cargo xtask parity`, ready stays ~55%, stage stays alpha; duplicated rows and headers folded; previous: minor, hours to ~95% per audience added) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-24 · **Change:** trivial (progress log: Edit Points handle drags with Shift, Ctrl/Cmd or Alt/Option set the point type; previous: trivial, progress log: scroll bars on the zoomed slide pane, #1157; previous: minor, native chart payloads stored in bounded ZIP members; previous: major, community PR wave 2026-10-14: ~60 landed items in the progress log, among them the Font, Paragraph, Photo Album, theme colour and font and Date and Time dialogs, presenter and show controls, the SmartArt Text Pane and PPTX corpus slices; breadth 84% after `cargo xtask parity`, ready stays ~55%, stage stays alpha; duplicated rows and headers folded; previous: minor, hours to ~95% per audience added) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) @@ -146,6 +147,7 @@ app's JSON control channel (`deckcraft --control PORT`). | Date | What landed | |---|---| +| 2026-10-30 | Animation ▸ Effect Options shows readable labels for directions, split/shape variants, wheel spokes and other option values; stored codes are unchanged | | 2026-10-29 | Slide Show: going back to the previous slide plays the transition of the slide being left, reversed, as PowerPoint does, instead of the previous slide's own entrance transition (#1531); a jump (Go to Slide, links) still plays the target slide's transition | | 2026-10-27 | Set Up Slide Show ▸ Keep mouse cursor visible: a full-screen show no longer hides a still pointer, so the choices of a branching deck stay visible and clickable; the setting is kept with the user's preferences (`ui.json`, `showKeepCursor`), off by default (#1445) | | 2026-10-25 | A photo in a picture placeholder is cut into the shape its layout gives the placeholder, as PowerPoint draws it: a layout's round picture placeholder keeps a slide's photo in a circle with the layout's white border, where it came out as a rectangle (the reader only passed `p:sp` placeholders to `inherit_placeholder_geometry`, not `p:pic`) | @@ -314,6 +316,7 @@ app's JSON control channel (`deckcraft --control PORT`). | Date | Change | Summary | |---|---|---| +| 2026-10-30 | trivial | Progress log: animation Effect Options show readable labels. Scores and milestone names unchanged | | 2026-10-29 | trivial | Progress log: going back in the slide show reverses the left slide's transition (#1531). Scores and milestone names unchanged | | 2026-10-29 | trivial | Progress log: the Picture Styles row leaves room for Crop and Size (#1232). Scores and milestone names unchanged | | 2026-10-25 | trivial | Progress log: a picture in a picture placeholder takes the layout's shape. Scores and milestone names unchanged | diff --git a/crates/ui-egui/src/ribbon/animations.rs b/crates/ui-egui/src/ribbon/animations.rs index 67f0bbd00..6d35afdcb 100644 --- a/crates/ui-egui/src/ribbon/animations.rs +++ b/crates/ui-egui/src/ribbon/animations.rs @@ -1,4 +1,3 @@ -use super::transitions::option_label; use super::{ Align2, AnimClass, CornerRadius, Icon, Rect, Sense, SlideApp, Tokens, Ui, big, big_button, big_button_ex, dropdown, enabled, group, icons, json, pos2, rows, run, theme, vec2, widgets, @@ -81,12 +80,13 @@ pub(super) fn animations(app: &mut SlideApp, ui: &mut Ui) { } }); let effect_rows = cur.as_ref().map(|c| animation_effect_rows(&c.effect, c.class, Some(c.option.as_str()))).unwrap_or_default(); + let effect = cur.as_ref().map(|c| c.effect.as_str()).unwrap_or_default(); let build = cur.as_ref().map(|c| text_build_id(c.text_build)); let build_rows = marked_options(&["asOne", "byParagraph"], build); let r = big_button(ui, Icon::EffectOptions, "Effect\nOptions", !effect_rows.is_empty()); egui::Popup::menu(&r).show(|ui| { for &(o, on) in &effect_rows { - if ui.selectable_label(on, option_label(o)).clicked() { + if ui.selectable_label(on, animation_option_label(effect, o)).clicked() { run(app, "animation.options", json!({"option": o})); ui.close(); } @@ -216,6 +216,67 @@ pub(super) fn animation_effect_rows(effect: &str, class: AnimClass, current: Opt marked_options(opts, current) } +fn animation_option_label(effect: &str, option: &str) -> String { + let direction = match option { + "b" => Some("From Bottom"), + "lb" => Some("From Bottom-Left"), + "l" => Some("From Left"), + "lt" => Some("From Top-Left"), + "t" => Some("From Top"), + "rt" => Some("From Top-Right"), + "r" => Some("From Right"), + "rb" => Some("From Bottom-Right"), + _ => None, + }; + if matches!(effect, "fly" | "flyOut" | "wipe" | "wipeOut" | "peek" | "peekOut") + && let Some(label) = direction + { + return label.into(); + } + + match (effect, option) { + ("float" | "floatOut", "u") => "Up".into(), + ("float" | "floatOut", "d") => "Down".into(), + ("split" | "splitOut", "horzIn") => "Horizontal In".into(), + ("split" | "splitOut", "horzOut") => "Horizontal Out".into(), + ("split" | "splitOut", "vertIn") => "Vertical In".into(), + ("split" | "splitOut", "vertOut") => "Vertical Out".into(), + ("shape" | "shapeOut", o) if o.ends_with("In") => format!("{} In", title_first(shape_option_name(o))), + ("shape" | "shapeOut", o) if o.ends_with("Out") => format!("{} Out", title_first(shape_option_name(o))), + ("wheel" | "wheelOut", "1") => "1 Spoke".into(), + ("wheel" | "wheelOut", n) => format!("{n} Spokes"), + ("box" | "boxOut" | "circle" | "diamond", "in") => format!("{} In", title_first(effect.trim_end_matches("Out"))), + ("box" | "boxOut" | "circle" | "diamond", "out") => format!("{} Out", title_first(effect.trim_end_matches("Out"))), + ("zoom" | "zoomOut", "in") => "Zoom In".into(), + ("zoom" | "zoomOut", "out") => "Zoom Out".into(), + (_, "lu") => "From Top-Left".into(), + (_, "ru") => "From Top-Right".into(), + (_, "ld") => "From Bottom-Left".into(), + (_, "rd") => "From Bottom-Right".into(), + (_, "horz") => "Horizontal".into(), + (_, "vert") => "Vertical".into(), + (_, "across") => "Across".into(), + (_, "down") => "Down".into(), + (_, "up") => "Up".into(), + (_, "right") => "Right".into(), + (_, "left") => "Left".into(), + (_, "clockwise") => "Clockwise".into(), + (_, "counterClockwise") => "Counterclockwise".into(), + (_, "in") => "In".into(), + (_, "out") => "Out".into(), + (_, other) => super::transitions::option_label(other), + } +} + +fn shape_option_name(option: &str) -> &str { + option.strip_suffix("In").or_else(|| option.strip_suffix("Out")).unwrap_or(option) +} + +fn title_first(value: &str) -> String { + let mut chars = value.chars(); + chars.next().map(|c| c.to_uppercase().collect::() + chars.as_str()).unwrap_or_default() +} + pub(super) fn text_build_id(build: deckcraft_model::anim::TextBuild) -> &'static str { match build { deckcraft_model::anim::TextBuild::ByParagraph => "byParagraph", @@ -224,3 +285,27 @@ pub(super) fn text_build_id(build: deckcraft_model::anim::TextBuild) -> &'static deckcraft_model::anim::TextBuild::AsOne => "asOne", } } + +#[cfg(test)] +mod animation_option_label_tests { + use super::animation_option_label; + use deckcraft_model::anim::ANIMATIONS; + + #[test] + fn labels_every_animation_gallery_option_without_changing_its_code() { + for &(effect, _, _, _, _, options) in ANIMATIONS { + for &option in options { + let label = animation_option_label(effect, option); + assert!(!label.is_empty(), "{effect}/{option}"); + assert_ne!(label, option, "raw option shown for {effect}/{option}"); + } + } + assert_eq!(animation_option_label("fly", "lb"), "From Bottom-Left"); + assert_eq!(animation_option_label("flyOut", "rt"), "From Top-Right"); + assert_eq!(animation_option_label("wipe", "b"), "From Bottom"); + assert_eq!(animation_option_label("wheel", "1"), "1 Spoke"); + assert_eq!(animation_option_label("split", "vertOut"), "Vertical Out"); + assert_eq!(animation_option_label("shape", "circleIn"), "Circle In"); + assert_eq!(animation_option_label("diamond", "out"), "Diamond Out"); + } +} diff --git a/docs/animation-parity.md b/docs/animation-parity.md index b7f840a92..ffca88c9d 100644 --- a/docs/animation-parity.md +++ b/docs/animation-parity.md @@ -1,6 +1,6 @@ # Transitions and animations: parity with PowerPoint -> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-29 · **Change:** minor (going back in the show reverses the left slide's transition, #1531; previous: minor, Animation Pane ▸ Play From plays from the selected effect; previous: community PR wave 2026-10-14: interactive-deck triggers, canvas preview, the Animation Pane timeline, repeat and bounce end round-trip; duplicated rows and headers folded; previous: major, transitions measured frame by frame against PowerPoint for Windows' video export) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) +> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-30 · **Change:** trivial (animation Effect Options translate stored codes into readable labels; previous: minor, going back in the show reverses the left slide's transition, #1531; previous: minor, Animation Pane ▸ Play From plays from the selected effect; previous: community PR wave 2026-10-14: interactive-deck triggers, canvas preview, the Animation Pane timeline, repeat and bounce end round-trip; duplicated rows and headers folded; previous: major, transitions measured frame by frame against PowerPoint for Windows' video export) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) Transitions and animations are what make a deck a presentation, and the part of PowerPoint people notice first when it's missing. Scores roll up into [target-app-parity.md](target-app-parity.md) @@ -65,7 +65,7 @@ In, Wipe, Zoom, Float In, Grow/Shrink, Pulse, Spin, motion lines): weighted, ~85 | Animation feature | PowerPoint | DeckCraft | |---|---|---| | Start On Click / With Previous / After Previous, duration, delay | yes | yes | -| Effect Options (direction, sequence by paragraph) | yes | yes | +| Effect Options (direction, sequence by paragraph) | yes | yes; every gallery option has a readable label while retaining its stored code | | Effect dialog: sound, after-animation dim/hide, animate text by word/letter, smooth start/end, bounce end, repeat, rewind | yes | partly; repeat, bounce end and rewind round-trip | | By-paragraph text builds, sub-bullets follow parents | yes | yes; builds edited in PowerPoint (own start per paragraph, other effects in between, by 2nd-level paragraphs) import as one effect per paragraph and keep their clicks (#844) | | Triggers (on click of a shape) | yes | yes; played in the show: a step per click, the sequence starts over after its last step, a click completes a playing step. Separate click steps, mixed starts and paragraph builds survive PPTX save (`trigger_steps.rs`) | @@ -94,6 +94,7 @@ In, Wipe, Zoom, Float In, Grow/Shrink, Pulse, Spin, motion lines): weighted, ~85 | Date | Change | Summary | |---|---|---| +| 2026-10-30 | trivial | Animation Effect Options show readable, effect-aware labels for all gallery option codes; stored values and command parameters stay unchanged | | 2026-10-29 | minor | Going back in the show plays the transition of the slide being left, reversed, instead of the previous slide's entrance transition (#1531); new row in the transition features. Scores unchanged | | 2026-10-22 | minor | Animation Pane ▸ Play From: with an effect selected, the preview starts at that effect on the play-all clock; the row says yes and the estimate drops to ~14–26 h | | 2026-10-15 | trivial | PPTX interactive sequences preserve later On Click effects and one click per paragraph; no change to playback or feature scores | diff --git a/docs/gaps.md b/docs/gaps.md index c1746a17f..885a64d16 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,5 +1,6 @@ # Where DeckCraft falls short of PowerPoint +> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-30 · **Change:** trivial (animation Effect Options now show readable labels; Animation Pane gap remains) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-28 · **Change:** trivial (AutoFormat lists run independently of Replace text as you type; previous: minor, Animation Pane ▸ Play From; previous: minor, native chart payloads stored in bounded ZIP members; previous: major, community PR wave 2026-10-14: soak tests, PPTX corpus, comment threads (#70), embedded fonts, SmartArt Text Pane, Animation Pane timeline, Hunspell spelling, thesaurus, AutoCorrect, 14 new dialogs, pen pressure and trackpad gestures; duplicated entries and headers folded; previous: minor, 3-D bevel, camera and face lighting rendered) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-20 · **Change:** trivial (empty chart number-format sections hide values; previous: minor, native chart payloads stored in bounded ZIP members; previous: major, community PR wave 2026-10-14: soak tests, PPTX corpus, comment threads (#70), embedded fonts, SmartArt Text Pane, Animation Pane timeline, Hunspell spelling, thesaurus, AutoCorrect, 14 new dialogs, pen pressure and trackpad gestures; duplicated entries and headers folded; previous: minor, 3-D bevel, camera and face lighting rendered) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-27 · **Last updated:** 2026-10-27 · **Change:** minor (docs refresh against merged PRs: #67 and #77 landed, #75 closed unmerged, #53 closed, Windows image paste is #1414; one header line; previous: minor, Animation Pane ▸ Play From; previous: minor, native chart payloads stored in bounded ZIP members; previous: major, community PR wave 2026-10-14: soak tests, PPTX corpus, comment threads (#70), embedded fonts, SmartArt Text Pane, Animation Pane timeline, Hunspell spelling, thesaurus, AutoCorrect, 14 new dialogs, pen pressure and trackpad gestures; duplicated entries and headers folded; previous: minor, 3-D bevel, camera and face lighting rendered) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) @@ -28,7 +29,7 @@ revision history. | 7 | Fonts: only Regular, Bold and Italic faces (#69) | Feature | B | 3–5 | [ui-parity.md](ui-parity.md) | | 8 | Image paste fails on Windows (#1414); Linux not re-checked | Feature | B | 2–4 | [ui-parity.md](ui-parity.md) | | 9 | Presenter view isn't placed on the second display | Hardware | B | 3–5 | [slideshow-parity.md](slideshow-parity.md) | -| 10 | Animation Pane: 64 of ~190 effects, effect options (timeline and Play From done) | Feature | B (pane) | 7–13 | [animation-parity.md](animation-parity.md) | +| 10 | Animation Pane: 64 of ~190 effects, effect options (readable labels, timeline and Play From done) | Feature | B (pane) | 7–13 | [animation-parity.md](animation-parity.md) | | 11 | Charts: data grid editing, elements, `chartex` types | Feature | B (data, elements) | 12–20 | [parity-checklist.md](parity-checklist.md) | | 12 | Format Shape pane thinner than PowerPoint's | UI/UX | B | 6–10 | [ui-parity.md](ui-parity.md) | | 13 | No native macOS menu bar | UI/UX | B | 3–5 | [ui-parity.md](ui-parity.md) | @@ -370,6 +371,7 @@ Detail in [localization-parity.md](localization-parity.md). | Date | Change | Summary | |---|---|---| +| 2026-10-30 | trivial | Animation effect options display readable labels for every gallery value; the broader Animation Pane gap remains | | 2026-10-28 | trivial | Automatic lists now run independently of Replace text as you type; proofing gap description updated | | 2026-10-27 | minor | Refreshed against merged PRs: removed the Morph alignment entry (#67 merged 2026-10-14); #77 (animation rewind, PR #83) is fixed, leaving #74 in the round-trip gap; #75 was closed unmerged, so #60 stays open with no fix PR; #53 is closed and the image-paste gap is now Windows #1414; Reuse Slides (#1103) and Compare reject (#850) noted in the smaller rows; the duplicate header line is gone | | 2026-10-25 | trivial | New entries: copying text and cell ranges (no media, no table), a control-server timing test that may fail under load; Proofing notes that automatic lists follow Replace text as you type and that Backspace puts the typed lead back | From 77e3a444b816eaea93dc2b608cf46043e243d902 Mon Sep 17 00:00:00 2001 From: DominicTheD3v <119626487+DominicTheD3v@users.noreply.github.com> Date: Sat, 31 Oct 2026 00:21:06 +0000 Subject: [PATCH 029/716] Update crates/engine/src/tools/drag.rs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- crates/engine/src/tools/drag.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/engine/src/tools/drag.rs b/crates/engine/src/tools/drag.rs index 24f0ae978..a25e47858 100644 --- a/crates/engine/src/tools/drag.rs +++ b/crates/engine/src/tools/drag.rs @@ -55,7 +55,7 @@ impl Session { hx * sx * o.w / div * if o.flip_h { -1.0 } else { 1.0 }, hy * sy * o.h / div * if o.flip_v { -1.0 } else { 1.0 }, ); - resize_box(o, handle, Vec2::new(lp.x, lp.y), keep_aspect, mods.alt) + resize_box(o, handle, Vec2::new(lp.x, lp.y), self.is_picture(*tid), mods.alt) }; self.set_xfrm(*tid, target_nx)?; } From 9aef8cc5ab9d9b2d82198ffb632ea9fc0a8a90be Mon Sep 17 00:00:00 2001 From: DominicTheD3v <119626487+DominicTheD3v@users.noreply.github.com> Date: Sat, 31 Oct 2026 01:03:53 +0000 Subject: [PATCH 030/716] fix: addressing issues raised by coderabbit --- crates/engine/src/tools/drag.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/crates/engine/src/tools/drag.rs b/crates/engine/src/tools/drag.rs index 24f0ae978..d65ae690a 100644 --- a/crates/engine/src/tools/drag.rs +++ b/crates/engine/src/tools/drag.rs @@ -27,9 +27,6 @@ impl Session { return self.drag_move(MoveDrag { ids, start, origs, moved, duplicate, enter_text }, p, mods, tol); } Drag::Resize { id, orig, ids, handle, origs, start } => { - if orig.w <= 0.0 || orig.h <= 0.0 { - return Ok(Value::Null); - } let keep_aspect = mods.shift || self.is_picture(id); let nx = resize_box(&orig, handle, p - start, keep_aspect, mods.alt); let nx = self.snap_resize(nx, handle, &ids, tol); From 4ab850e248a074abe300b435367131ec750dfb76 Mon Sep 17 00:00:00 2001 From: marshiyar <57055687+marshiyar@users.noreply.github.com> Date: Fri, 30 Oct 2026 20:26:20 -0700 Subject: [PATCH 031/716] Media: cap symphonia audio decode and measure unindexed audio without decoding --- crates/media/src/audio.rs | 65 +++++++++++++++++++++++++++++++++++++++ crates/media/src/probe.rs | 9 +++--- 2 files changed, 70 insertions(+), 4 deletions(-) diff --git a/crates/media/src/audio.rs b/crates/media/src/audio.rs index 5f623a3e2..cca566be0 100644 --- a/crates/media/src/audio.rs +++ b/crates/media/src/audio.rs @@ -169,6 +169,11 @@ fn contained(f: impl FnOnce() -> Result) -> Result { const MAX_DEMUX_ERRORS: u32 = 64; fn decode_symphonia(bytes: &Bytes, ext: &str) -> Result { + decode_symphonia_capped(bytes, ext, MAX_PCM_SAMPLES) +} + +/// [`decode_symphonia`] failing once more than `max_samples` samples have been decoded. +fn decode_symphonia_capped(bytes: &Bytes, ext: &str, max_samples: usize) -> Result { let mss = MediaSourceStream::new(Box::new(Cursor::new(Shared(bytes.clone()))), MediaSourceStreamOptions::default()); let mut hint = Hint::new(); match ext { @@ -242,6 +247,9 @@ fn decode_symphonia(bytes: &Bytes, ext: &str) -> Result { } if let Some(b) = buf.as_mut() { b.copy_interleaved_ref(decoded); + if b.samples().len() > max_samples.saturating_sub(out.len()) { + return Err(MediaError::Unsupported("audio this long".into())); + } out.extend_from_slice(b.samples()); } } @@ -277,6 +285,48 @@ pub(crate) fn probe_symphonia(bytes: &Bytes, ext: &str) -> Option<(String, u32, Some((name, p.sample_rate.unwrap_or(0), p.channels.map(|c| c.count() as u16).unwrap_or(0), p.n_frames)) } +/// Length in milliseconds of the first decodable track, summed from its packet durations: the +/// file is demuxed but not decoded. `None` when the demuxer reports no durations. +pub(crate) fn demux_duration_ms(bytes: &Bytes, ext: &str) -> Option { + std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { + let mss = MediaSourceStream::new(Box::new(Cursor::new(Shared(bytes.clone()))), MediaSourceStreamOptions::default()); + let mut hint = Hint::new(); + if ext != "unknown" { + hint.with_extension(ext); + } + let opts = FormatOptions { enable_gapless: true, ..Default::default() }; + let mut format = symphonia::default::get_probe().format(&hint, mss, &opts, &MetadataOptions::default()).ok()?.format; + let t = format.tracks().iter().find(|t| t.codec_params.codec != CODEC_TYPE_NULL)?; + let (id, tb) = (t.id, t.codec_params.time_base?); + let mut ticks = 0u64; + let mut errors = 0u32; + loop { + match format.next_packet() { + Ok(p) => { + errors = 0; + if p.track_id() == id { + ticks = ticks.saturating_add(p.dur); + } + } + Err(SymError::DecodeError(_)) => { + errors += 1; + if errors > MAX_DEMUX_ERRORS { + break; + } + } + Err(_) => break, + } + } + if ticks == 0 { + return None; + } + let t = tb.calc_time(ticks); + Some(t.seconds.saturating_mul(1000).saturating_add((t.frac * 1000.0).round() as u64)) + })) + .ok() + .flatten() +} + /// Interleaved PCM resampled (linear) to `rate`. pub fn resample(pcm: &Pcm, rate: u32) -> Pcm { if pcm.rate == rate || pcm.rate == 0 || rate == 0 { @@ -313,6 +363,21 @@ mod tests { assert!((r.at(101, 0) - 0.505).abs() < 1e-3); } + /// A sample cap makes a long decode fail instead of growing without bound. + #[test] + fn decode_past_the_sample_cap_is_an_error() { + let b: Bytes = std::sync::Arc::new(std::fs::read(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/fixtures/tone.aac")).unwrap_or_default()); + assert!(decode_symphonia_capped(&b, "aac", usize::MAX).is_ok()); + assert!(decode_symphonia_capped(&b, "aac", 1000).is_err()); + } + + #[test] + fn demux_duration_matches_decoded_length() { + let b: Bytes = std::sync::Arc::new(std::fs::read(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/fixtures/tone.aac")).unwrap_or_default()); + let ms = demux_duration_ms(&b, "aac").unwrap_or(0) as i64; + assert!((ms - 500).abs() <= 60, "{ms} ms"); + } + #[test] fn wma_is_reported_unsupported() { let mut b = crate::ASF_HEADER.to_vec(); diff --git a/crates/media/src/probe.rs b/crates/media/src/probe.rs index 97d9a751f..67f4a2c26 100644 --- a/crates/media/src/probe.rs +++ b/crates/media/src/probe.rs @@ -1,5 +1,5 @@ //! Media probing: container, duration, audio and video stream parameters — without decoding -//! (except for audio files whose container doesn't state a length). +//! (audio files whose container doesn't state a length are demuxed, not decoded). use crate::video::{codec_name, mkv_codec_name}; use crate::{ASF_HEADER, Bytes, Container, MediaError, Result}; @@ -50,9 +50,10 @@ fn ms(secs: f64) -> u64 { pub fn probe(bytes: &Bytes) -> Result { let mut info = probe_headers(bytes)?; if info.duration_ms == 0 && info.audio.as_ref().is_some_and(|a| a.decodable) && info.video.is_none() { - // No length in the header (raw MP3 / ADTS without an index): decode to measure. - if let Ok(pcm) = crate::audio::decode(bytes) { - info.duration_ms = ms(pcm.duration()); + // No length in the header (raw MP3 / ADTS without an index): add up the packet + // lengths. This only demuxes, so a long file neither allocates its PCM nor stalls the caller. + if let Some(d) = crate::audio::demux_duration_ms(bytes, Container::sniff(bytes).name()) { + info.duration_ms = d; } } Ok(info) From b1900e526d02ab4b05c88de0782a0b8953f99be4 Mon Sep 17 00:00:00 2001 From: Harrison Booth <73434116+Harrison-Booth@users.noreply.github.com> Date: Fri, 30 Oct 2026 22:42:28 -0500 Subject: [PATCH 032/716] Preserve point-sized bullets in PPTX --- crates/model/src/text.rs | 3 +++ crates/pptx/src/read/dml.rs | 4 ++++ crates/pptx/src/write/dml.rs | 4 ++++ crates/pptx/tests/it/roundtrip.rs | 24 ++++++++++++++++++++++++ crates/text/src/shape.rs | 4 ++-- 5 files changed, 37 insertions(+), 2 deletions(-) diff --git a/crates/model/src/text.rs b/crates/model/src/text.rs index 17d606de7..525f1df3c 100644 --- a/crates/model/src/text.rs +++ b/crates/model/src/text.rs @@ -240,6 +240,8 @@ pub struct ParaProps { pub bullet_color: Option, /// Bullet size as a fraction of the text size. pub bullet_size: Option, + /// Absolute bullet font size in points, independent of the paragraph's run size. + pub bullet_size_points: Option, pub tabs: Option>, pub default_tab: Option, pub rtl: Option, @@ -270,6 +272,7 @@ impl ParaProps { self.bullet_color.clone_from(&p.bullet_color); } self.bullet_size = self.bullet_size.or(p.bullet_size); + self.bullet_size_points = self.bullet_size_points.or(p.bullet_size_points); if self.tabs.is_none() { self.tabs.clone_from(&p.tabs); } diff --git a/crates/pptx/src/read/dml.rs b/crates/pptx/src/read/dml.rs index 767b7dc02..7a3cc2179 100644 --- a/crates/pptx/src/read/dml.rs +++ b/crates/pptx/src/read/dml.rs @@ -433,6 +433,10 @@ pub fn ppr(imp: &mut Imp, part: &Part, p: &El) -> (Option, ParaProps, Option "buFont" => pp.bullet_font = e.attr("typeface").map(String::from), "buClr" => pp.bullet_color = color(e), "buSzPct" => pp.bullet_size = pct(e, "val").map(|v| v.clamp(0.25, 4.0)), + "buSzPts" => { + pp.bullet_size_points = + e.attr("val").and_then(|v| v.parse::().ok()).filter(|v| v.is_finite() && *v > 0.0 && *v <= 40_000.0).map(|v| v / 100.0); + } "tabLst" => { pp.tabs = Some( e.children_named("tab") diff --git a/crates/pptx/src/write/dml.rs b/crates/pptx/src/write/dml.rs index 518f8c4af..70b085e2e 100644 --- a/crates/pptx/src/write/dml.rs +++ b/crates/pptx/src/write/dml.rs @@ -535,6 +535,7 @@ pub fn ppr(w: &mut W, x: &mut Exp, o: &mut Out, tag: &str, level: Option, p: || p.bullet_font.is_some() || p.bullet_color.is_some() || p.bullet_size.is_some() + || p.bullet_size_points.is_some() || p.tabs.is_some() || def.is_some(); if !has_kids { @@ -559,6 +560,9 @@ pub fn ppr(w: &mut W, x: &mut Exp, o: &mut Out, tag: &str, level: Option, p: if let Some(s) = p.bullet_size { w.val("a:buSzPct", pct(s.clamp(0.25, 4.0))); } + if let Some(s) = p.bullet_size_points { + w.val("a:buSzPts", ((s.clamp(0.01, 400.0) * 100.0).round() as u32).to_string()); + } if let Some(f) = &p.bullet_font { w.empty("a:buFont", A::new().a("typeface", f)); } diff --git a/crates/pptx/tests/it/roundtrip.rs b/crates/pptx/tests/it/roundtrip.rs index 370cc9a9f..7936234ce 100644 --- a/crates/pptx/tests/it/roundtrip.rs +++ b/crates/pptx/tests/it/roundtrip.rs @@ -488,6 +488,30 @@ fn shapes_fills_lines_effects_round_trip() { assert_eq!(by_name(&q.slides[1], "Group").id, by_name(&p.slides[1], "Group").id); } +#[test] +fn bullet_size_in_points_survives_two_pptx_round_trips() { + let mut p = Presentation::default(); + let mut textbox = shape(&mut p, "Point-sized bullet", 20.0, 20.0, 400.0, 100.0); + textbox.text = Some(TextBody { + paragraphs: vec![Paragraph { + props: deckcraft_model::text::ParaProps { + bullet: Some(Bullet::Char { char: "•".into() }), + bullet_size_points: Some(12.0), + ..Default::default() + }, + runs: vec![Run::with("Bullet text", RunProps::default())], + ..Default::default() + }], + ..Default::default() + }); + Arc::make_mut(&mut p.slides[0]).shapes.push(textbox); + + let q = round(&round(&p)); + let props = &by_name(&q.slides[0], "Point-sized bullet").text.as_ref().expect("text").paragraphs[0].props; + assert_eq!(props.bullet_size_points, Some(12.0)); + assert_eq!(props.bullet_size, None); +} + #[test] fn pictures_media_and_ink_round_trip() { let p = rich_deck(); diff --git a/crates/text/src/shape.rs b/crates/text/src/shape.rs index 2be8424f7..d5558001d 100644 --- a/crates/text/src/shape.rs +++ b/crates/text/src/shape.rs @@ -76,7 +76,7 @@ pub(crate) fn shape_para( if let Some(c) = &props.bullet_color { rp.fill = Some(Fill::solid(c.clone())); } - rp.size = Some(lead.size.unwrap_or(18.0) * props.bullet_size.unwrap_or(1.0)); + rp.size = Some(props.bullet_size_points.unwrap_or(lead.size.unwrap_or(18.0) * props.bullet_size.unwrap_or(1.0))); rp.underline = None; rp.strike = None; rp.highlight = None; @@ -105,7 +105,7 @@ pub(crate) fn shape_para( if let Some(c) = &props.bullet_color { rp.fill = Some(Fill::solid(c.clone())); } - rp.size = Some(lead.size.unwrap_or(18.0) * props.bullet_size.unwrap_or(1.0)); + rp.size = Some(props.bullet_size_points.unwrap_or(lead.size.unwrap_or(18.0) * props.bullet_size.unwrap_or(1.0))); rp.underline = None; let mut st = make_style(ctx, &rp, scale, opts.prompt_color); let label = autonum(scheme, start_at.saturating_sub(1).saturating_add(number.unwrap_or(1))); From 917d4b96a9ceb2063a2739a098375fad1395f3bc Mon Sep 17 00:00:00 2001 From: Harrison Booth <73434116+Harrison-Booth@users.noreply.github.com> Date: Fri, 30 Oct 2026 23:07:54 -0500 Subject: [PATCH 033/716] Honor bullet size schema bounds and inheritance --- crates/model/src/text.rs | 29 +++++++++++++++++++++++++++-- crates/pptx/src/read/dml.rs | 8 ++++++-- crates/pptx/src/write/dml.rs | 7 +++---- crates/pptx/tests/it/roundtrip.rs | 25 ++++++++++++++----------- 4 files changed, 50 insertions(+), 19 deletions(-) diff --git a/crates/model/src/text.rs b/crates/model/src/text.rs index 525f1df3c..8d01cdcd2 100644 --- a/crates/model/src/text.rs +++ b/crates/model/src/text.rs @@ -271,8 +271,13 @@ impl ParaProps { if self.bullet_color.is_none() { self.bullet_color.clone_from(&p.bullet_color); } - self.bullet_size = self.bullet_size.or(p.bullet_size); - self.bullet_size_points = self.bullet_size_points.or(p.bullet_size_points); + if self.bullet_size.is_none() && self.bullet_size_points.is_none() { + if p.bullet_size_points.is_some() { + self.bullet_size_points = p.bullet_size_points; + } else { + self.bullet_size = p.bullet_size; + } + } if self.tabs.is_none() { self.tabs.clone_from(&p.tabs); } @@ -287,6 +292,26 @@ impl ParaProps { } } +#[cfg(test)] +mod bullet_size_tests { + use super::ParaProps; + + #[test] + fn bullet_size_inheritance_keeps_percentage_and_points_as_one_mode() { + let parent = ParaProps { bullet_size_points: Some(12.0), ..Default::default() }; + let mut child = ParaProps { bullet_size: Some(2.0), ..Default::default() }; + child.inherit(&parent); + assert_eq!(child.bullet_size, Some(2.0)); + assert_eq!(child.bullet_size_points, None); + + let parent = ParaProps { bullet_size: Some(1.5), ..Default::default() }; + let mut child = ParaProps { bullet_size_points: Some(14.0), ..Default::default() }; + child.inherit(&parent); + assert_eq!(child.bullet_size, None); + assert_eq!(child.bullet_size_points, Some(14.0)); + } +} + #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub enum Caps { diff --git a/crates/pptx/src/read/dml.rs b/crates/pptx/src/read/dml.rs index 7a3cc2179..5076c3761 100644 --- a/crates/pptx/src/read/dml.rs +++ b/crates/pptx/src/read/dml.rs @@ -432,10 +432,14 @@ pub fn ppr(imp: &mut Imp, part: &Part, p: &El) -> (Option, ParaProps, Option } "buFont" => pp.bullet_font = e.attr("typeface").map(String::from), "buClr" => pp.bullet_color = color(e), - "buSzPct" => pp.bullet_size = pct(e, "val").map(|v| v.clamp(0.25, 4.0)), + "buSzPct" => { + pp.bullet_size_points = None; + pp.bullet_size = pct(e, "val").map(|v| v.clamp(0.25, 4.0)); + } "buSzPts" => { + pp.bullet_size = None; pp.bullet_size_points = - e.attr("val").and_then(|v| v.parse::().ok()).filter(|v| v.is_finite() && *v > 0.0 && *v <= 40_000.0).map(|v| v / 100.0); + e.attr("val").and_then(|v| v.parse::().ok()).filter(|v| (100..=400_000).contains(v)).map(|v| v as f64 / 100.0); } "tabLst" => { pp.tabs = Some( diff --git a/crates/pptx/src/write/dml.rs b/crates/pptx/src/write/dml.rs index 70b085e2e..9efb990f7 100644 --- a/crates/pptx/src/write/dml.rs +++ b/crates/pptx/src/write/dml.rs @@ -557,12 +557,11 @@ pub fn ppr(w: &mut W, x: &mut Exp, o: &mut Out, tag: &str, level: Option, p: color(w, c); w.close("a:buClr"); } - if let Some(s) = p.bullet_size { + if let Some(s) = p.bullet_size_points.filter(|s| s.is_finite() && (1.0..=4000.0).contains(s)) { + w.val("a:buSzPts", ((s * 100.0).round() as u32).to_string()); + } else if let Some(s) = p.bullet_size { w.val("a:buSzPct", pct(s.clamp(0.25, 4.0))); } - if let Some(s) = p.bullet_size_points { - w.val("a:buSzPts", ((s.clamp(0.01, 400.0) * 100.0).round() as u32).to_string()); - } if let Some(f) = &p.bullet_font { w.empty("a:buFont", A::new().a("typeface", f)); } diff --git a/crates/pptx/tests/it/roundtrip.rs b/crates/pptx/tests/it/roundtrip.rs index 7936234ce..065eb8495 100644 --- a/crates/pptx/tests/it/roundtrip.rs +++ b/crates/pptx/tests/it/roundtrip.rs @@ -493,23 +493,26 @@ fn bullet_size_in_points_survives_two_pptx_round_trips() { let mut p = Presentation::default(); let mut textbox = shape(&mut p, "Point-sized bullet", 20.0, 20.0, 400.0, 100.0); textbox.text = Some(TextBody { - paragraphs: vec![Paragraph { - props: deckcraft_model::text::ParaProps { - bullet: Some(Bullet::Char { char: "•".into() }), - bullet_size_points: Some(12.0), + paragraphs: [12.0, 500.0, 4000.0] + .into_iter() + .map(|size| Paragraph { + props: deckcraft_model::text::ParaProps { + bullet: Some(Bullet::Char { char: "•".into() }), + bullet_size_points: Some(size), + ..Default::default() + }, + runs: vec![Run::with("Bullet text", RunProps::default())], ..Default::default() - }, - runs: vec![Run::with("Bullet text", RunProps::default())], - ..Default::default() - }], + }) + .collect(), ..Default::default() }); Arc::make_mut(&mut p.slides[0]).shapes.push(textbox); let q = round(&round(&p)); - let props = &by_name(&q.slides[0], "Point-sized bullet").text.as_ref().expect("text").paragraphs[0].props; - assert_eq!(props.bullet_size_points, Some(12.0)); - assert_eq!(props.bullet_size, None); + let props = &by_name(&q.slides[0], "Point-sized bullet").text.as_ref().expect("text").paragraphs; + assert_eq!(props.iter().map(|p| p.props.bullet_size_points).collect::>(), vec![Some(12.0), Some(500.0), Some(4000.0)]); + assert!(props.iter().all(|p| p.props.bullet_size.is_none())); } #[test] From 98138f563b357921ebc2f6fe6ff7ffd57d50aae7 Mon Sep 17 00:00:00 2001 From: Harrison Booth <73434116+Harrison-Booth@users.noreply.github.com> Date: Fri, 30 Oct 2026 23:24:07 -0500 Subject: [PATCH 034/716] Trim whitespace in bullet point sizes --- crates/pptx/src/read/dml.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/pptx/src/read/dml.rs b/crates/pptx/src/read/dml.rs index 5076c3761..11949be56 100644 --- a/crates/pptx/src/read/dml.rs +++ b/crates/pptx/src/read/dml.rs @@ -23,6 +23,10 @@ pub fn pct(e: &El, name: &str) -> Option { e.f64(name).map(|v| v / 100_000.0) } +fn bullet_size_points(value: Option<&str>) -> Option { + value.and_then(|v| v.trim().parse::().ok()).filter(|v| (100..=400_000).contains(v)).map(|v| v as f64 / 100.0) +} + /// 1/60 000 degree → degrees. pub fn ang(e: &El, name: &str) -> Option { e.f64(name).map(|v| v / 60_000.0) @@ -438,8 +442,7 @@ pub fn ppr(imp: &mut Imp, part: &Part, p: &El) -> (Option, ParaProps, Option } "buSzPts" => { pp.bullet_size = None; - pp.bullet_size_points = - e.attr("val").and_then(|v| v.parse::().ok()).filter(|v| (100..=400_000).contains(v)).map(|v| v as f64 / 100.0); + pp.bullet_size_points = bullet_size_points(e.attr("val")); } "tabLst" => { pp.tabs = Some( @@ -676,6 +679,13 @@ mod tests { assert_eq!(color(&d.root).unwrap().base, ColorBase::Rgb { rgb: Rgba::rgb(255, 0, 0) }); } + #[test] + fn bullet_point_size_trims_schema_whitespace() { + let d = parse(br#""#).unwrap(); + assert_eq!(bullet_size_points(d.root.attr("val")), Some(14.0)); + assert_eq!(bullet_size_points(Some("1400")), Some(14.0)); + } + #[test] fn body_props() { let d = parse(br#""#).unwrap(); From e747bff42525c7e6fde01bea4651db0dc7a94ae6 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 22:02:08 -0700 Subject: [PATCH 035/716] Shape Fill: the gradient help lists every kind and key the command takes The shape.fill params doc listed only linear and radial gradients with stops, angle and kind. The command also takes the rectangular and path kinds, focus and rotateWithShape. The doc now names them, and a test checks the doc's gradient keys and kinds against what the command reads. --- crates/engine/src/cmd/shape.rs | 2 +- crates/engine/src/tests.rs | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/shape.rs b/crates/engine/src/cmd/shape.rs index 9565cdf7b..08ed9be64 100644 --- a/crates/engine/src/cmd/shape.rs +++ b/crates/engine/src/cmd/shape.rs @@ -103,7 +103,7 @@ pub fn specs() -> Vec { "Shape Fill", ["Shape Format", "Shape Styles"], None, - "{color? | none?: true | background?: true (the slide background shows through; shapes and text boxes only) | gradient?: {stops: [[pos, color]], angle?, kind?: linear|radial} | picture?: base64 | pattern?: {preset, fg, bg} | transparency?: 0..1 | reset?: true, ids?}; pictureProps?: {tile?: bool, offsetX?, offsetY?: pt, scaleX?, scaleY?: 0..10, align?: tl|t|tr|l|ctr|r|bl|b|br, mirror?: none|x|y|xy, stretch?: [l, t, r, b] fractions, rotateWithShape?: bool} adjusts a picture fill; a group also formats its members", + "{color? | none?: true | background?: true (the slide background shows through; shapes and text boxes only) | gradient?: {stops: [[pos 0..1, color]], kind?: linear|radial|rectangular|path, angle?: deg (linear), focus?: [l, t, r, b] fractions (radial, rectangular and path: where the first stop sits), rotateWithShape?: bool} | picture?: base64 | pattern?: {preset, fg, bg} | transparency?: 0..1 | reset?: true, ids?}; pictureProps?: {tile?: bool, offsetX?, offsetY?: pt, scaleX?, scaleY?: 0..10, align?: tl|t|tr|l|ctr|r|bl|b|br, mirror?: none|x|y|xy, stretch?: [l, t, r, b] fractions, rotateWithShape?: bool} adjusts a picture fill; a group also formats its members", has_selection, fill ), diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 85cbe9d8c..1fc7fb2d7 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -4281,6 +4281,38 @@ fn a_params_doc_spells_out_each_parameter() { ); } +/// `shape.fill`'s params doc names each key and kind its `gradient` takes. +#[test] +fn shape_fill_documents_each_gradient_key_and_kind() { + use deckcraft_model::style::GradientShape; + let params = cmd::parse_params(find_command("shape.fill").unwrap().params).unwrap(); + let about = params.iter().find(|p| p.name == "gradient").unwrap().about; + assert_eq!(cmd::param_keys(about).unwrap(), ["stops", "kind", "angle", "focus", "rotateWithShape"]); + for kind in ["linear", "radial", "rectangular", "path"] { + assert!(about.contains(kind), "{kind}: {about}"); + let g = cmd::shape::gradient_param(&json!({ + "stops": [[0, "#ffffff"], [1, "#000000"]], + "kind": kind, + "angle": 30, + "focus": [0, 0, 1, 1], + "rotateWithShape": false + })) + .unwrap(); + assert!(!g.rotate_with_shape, "{kind}"); + match g.shape { + GradientShape::Linear { angle, .. } => assert_eq!((kind, angle), ("linear", 30.0)), + GradientShape::Path { path, focus } => { + let expected = match kind { + "radial" => "circle", + "rectangular" => "rect", + _ => "shape", + }; + assert_eq!((path.as_str(), focus), (expected, [0.0, 0.0, 1.0, 1.0]), "{kind}"); + } + } + } +} + #[test] fn what_a_command_acts_on_names_only_keys_it_takes() { for c in command_specs() { From 0540fe22cfe34a6e1da677324cebb47919428658 Mon Sep 17 00:00:00 2001 From: marshiyar <57055687+marshiyar@users.noreply.github.com> Date: Fri, 30 Oct 2026 22:13:52 -0700 Subject: [PATCH 036/716] Media: stop the Symphonia decode at the sample cap and measure the track playback decodes A decode past MAX_PCM_SAMPLES returned an error, so an MP3 or AAC longer than about 12 minutes that played before would not play at all. It now stops at the cap with whole frames and keeps what it has, like the Opus paths. demux_duration_ms measured the first track with any codec; it now measures the track playback decodes, picked by the same playable_track. Tests: decode_stops_at_the_sample_cap and duration_and_playback_pick_the_same_track fail without the change. --- crates/media/src/audio.rs | 72 +++++++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 21 deletions(-) diff --git a/crates/media/src/audio.rs b/crates/media/src/audio.rs index cca566be0..3feb87365 100644 --- a/crates/media/src/audio.rs +++ b/crates/media/src/audio.rs @@ -7,9 +7,9 @@ use std::io::Cursor; use symphonia::core::audio::SampleBuffer; -use symphonia::core::codecs::{CODEC_TYPE_NULL, DecoderOptions}; +use symphonia::core::codecs::{CODEC_TYPE_NULL, Decoder, DecoderOptions}; use symphonia::core::errors::Error as SymError; -use symphonia::core::formats::FormatOptions; +use symphonia::core::formats::{FormatOptions, Track}; use symphonia::core::io::{MediaSourceStream, MediaSourceStreamOptions}; use symphonia::core::meta::MetadataOptions; use symphonia::core::probe::Hint; @@ -172,7 +172,17 @@ fn decode_symphonia(bytes: &Bytes, ext: &str) -> Result { decode_symphonia_capped(bytes, ext, MAX_PCM_SAMPLES) } -/// [`decode_symphonia`] failing once more than `max_samples` samples have been decoded. +/// The track playback decodes, with its decoder: the first one a decoder can be made for (a +/// video's audio track follows its video track). The duration probe measures the same track. +fn playable_track(tracks: &[Track]) -> Option<(u32, Box)> { + let codecs = symphonia::default::get_codecs(); + tracks + .iter() + .filter(|t| t.codec_params.codec != CODEC_TYPE_NULL) + .find_map(|t| codecs.make(&t.codec_params, &DecoderOptions::default()).ok().map(|d| (t.id, d))) +} + +/// [`decode_symphonia`] stopping once `max_samples` samples have been decoded. fn decode_symphonia_capped(bytes: &Bytes, ext: &str, max_samples: usize) -> Result { let mss = MediaSourceStream::new(Box::new(Cursor::new(Shared(bytes.clone()))), MediaSourceStreamOptions::default()); let mut hint = Hint::new(); @@ -191,14 +201,7 @@ fn decode_symphonia_capped(bytes: &Bytes, ext: &str, max_samples: usize) -> Resu other => sym_err(other), })?; let mut format = probed.format; - let codecs = symphonia::default::get_codecs(); - // The first track we can decode (a video's audio track follows its video track). - let (track_id, mut decoder) = format - .tracks() - .iter() - .filter(|t| t.codec_params.codec != CODEC_TYPE_NULL) - .find_map(|t| codecs.make(&t.codec_params, &DecoderOptions::default()).ok().map(|d| (t.id, d))) - .ok_or(MediaError::Missing("audio track we can decode"))?; + let (track_id, mut decoder) = playable_track(format.tracks()).ok_or(MediaError::Missing("audio track we can decode"))?; let mut out: Vec = Vec::new(); let mut rate = 0; let mut channels = 0u16; @@ -247,10 +250,15 @@ fn decode_symphonia_capped(bytes: &Bytes, ext: &str, max_samples: usize) -> Resu } if let Some(b) = buf.as_mut() { b.copy_interleaved_ref(decoded); - if b.samples().len() > max_samples.saturating_sub(out.len()) { - return Err(MediaError::Unsupported("audio this long".into())); + // stop at the cap with whole frames, keeping what fits, like the Opus paths + let room = max_samples.saturating_sub(out.len()); + let s = b.samples(); + if s.len() > room { + let fit = room - room % (ch.max(1) as usize); + out.extend_from_slice(s.get(..fit).unwrap_or_default()); + break; } - out.extend_from_slice(b.samples()); + out.extend_from_slice(s); } } Err(SymError::DecodeError(e)) => log::debug!("audio decode: {e}"), @@ -285,7 +293,7 @@ pub(crate) fn probe_symphonia(bytes: &Bytes, ext: &str) -> Option<(String, u32, Some((name, p.sample_rate.unwrap_or(0), p.channels.map(|c| c.count() as u16).unwrap_or(0), p.n_frames)) } -/// Length in milliseconds of the first decodable track, summed from its packet durations: the +/// Length in milliseconds of the track playback decodes, summed from its packet durations: the /// file is demuxed but not decoded. `None` when the demuxer reports no durations. pub(crate) fn demux_duration_ms(bytes: &Bytes, ext: &str) -> Option { std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { @@ -296,8 +304,8 @@ pub(crate) fn demux_duration_ms(bytes: &Bytes, ext: &str) -> Option { } let opts = FormatOptions { enable_gapless: true, ..Default::default() }; let mut format = symphonia::default::get_probe().format(&hint, mss, &opts, &MetadataOptions::default()).ok()?.format; - let t = format.tracks().iter().find(|t| t.codec_params.codec != CODEC_TYPE_NULL)?; - let (id, tb) = (t.id, t.codec_params.time_base?); + let (id, _) = playable_track(format.tracks())?; + let tb = format.tracks().iter().find(|t| t.id == id)?.codec_params.time_base?; let mut ticks = 0u64; let mut errors = 0u32; loop { @@ -363,12 +371,34 @@ mod tests { assert!((r.at(101, 0) - 0.505).abs() < 1e-3); } - /// A sample cap makes a long decode fail instead of growing without bound. + /// A long decode stops at the sample cap and keeps what it has, like the Opus paths, so audio + /// past the cap still plays (up to the cap) instead of failing. #[test] - fn decode_past_the_sample_cap_is_an_error() { + fn decode_stops_at_the_sample_cap() { let b: Bytes = std::sync::Arc::new(std::fs::read(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/fixtures/tone.aac")).unwrap_or_default()); - assert!(decode_symphonia_capped(&b, "aac", usize::MAX).is_ok()); - assert!(decode_symphonia_capped(&b, "aac", 1000).is_err()); + let full = decode_symphonia_capped(&b, "aac", usize::MAX).unwrap(); + let capped = decode_symphonia_capped(&b, "aac", 1001).unwrap(); + assert!(full.samples.len() > 1001, "the fixture is longer than the cap"); + assert!(!capped.samples.is_empty() && capped.samples.len() <= 1001, "{}", capped.samples.len()); + assert_eq!(capped.samples.len() % capped.channels as usize, 0, "whole frames only"); + assert_eq!(capped.samples[..], full.samples[..capped.samples.len()], "the start is kept as decoded"); + } + + /// The duration is measured on the track playback decodes: the first one a decoder can be made + /// for, not the first one with any codec. + #[test] + fn duration_and_playback_pick_the_same_track() { + use symphonia::core::audio::Channels; + use symphonia::core::codecs::{CODEC_TYPE_AAC, CODEC_TYPE_OPUS, CodecParameters}; + let stereo = Channels::FRONT_LEFT | Channels::FRONT_RIGHT; + let mut opus = CodecParameters::new(); + opus.for_codec(CODEC_TYPE_OPUS).with_sample_rate(48_000).with_channels(stereo); + let mut aac = CodecParameters::new(); + aac.for_codec(CODEC_TYPE_AAC).with_sample_rate(44_100).with_channels(stereo); + let tracks = [Track::new(1, opus), Track::new(2, aac)]; + // the first track has a codec but no decoder in this build (Symphonia has no Opus decoder) + assert_ne!(tracks[0].codec_params.codec, CODEC_TYPE_NULL); + assert_eq!(playable_track(&tracks).map(|(id, _)| id), Some(2)); } #[test] From c3e9bd07e5600662ee4230b609144498f3fe7e05 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sat, 31 Oct 2026 06:38:17 +0100 Subject: [PATCH 037/716] Reject invalid slide index in design.background Found while testing crates/engine/src/cmd/design/slide_background.rs:65 (index via usize_param); write_background at :175 Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/engine/src/cmd/design/slide_background.rs | 4 ++-- crates/engine/src/cmd/design/tests.rs | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd/design/slide_background.rs b/crates/engine/src/cmd/design/slide_background.rs index 0de78e7e3..92f3ce773 100644 --- a/crates/engine/src/cmd/design/slide_background.rs +++ b/crates/engine/src/cmd/design/slide_background.rs @@ -1,6 +1,6 @@ use super::{ Arc, BTreeSet, Background, Fill, NO_ID_SPACE, Presentation, Result, Session, Target, Value, bad, bool_or, bool_param, color_param, color_value, - f64_param, ok, usize_param, with_param, + f64_param, ok, opt_usize_param, usize_param, with_param, }; pub(super) fn background(s: &mut Session, p: &Value) -> Result { @@ -62,7 +62,7 @@ pub(super) fn background(s: &mut Session, p: &Value) -> Result { )); }; let all = bool_or(p, "all", false); - let index = usize_param(p, "index"); + let index = opt_usize_param(p, "index", "design.background")?; if matches!(op, BgOp::Adjust) { let next = { let st = s.doc()?; diff --git a/crates/engine/src/cmd/design/tests.rs b/crates/engine/src/cmd/design/tests.rs index 9765fcc8f..82eed6feb 100644 --- a/crates/engine/src/cmd/design/tests.rs +++ b/crates/engine/src/cmd/design/tests.rs @@ -485,3 +485,16 @@ fn background_all_clears_layout_overrides_even_if_slides_and_master_match() { s.execute("design.background", &json!({"color": "#AA0000", "all": true})).unwrap(); assert_eq!(undo_len(&s), n + 1, "now it is truly a no-op"); } + +#[test] +fn background_rejects_invalid_index() { + let mut s = Session::with_new(); + s.execute("slide.new", &json!({})).unwrap(); + s.execute("slide.go", &json!({"index": 0})).unwrap(); + let before = s.doc().unwrap().doc.slides[0].background.clone(); + for bad in [json!(-1), json!(1.5)] { + assert!(s.execute("design.background", &json!({"color": "#0000C8", "index": bad})).is_err()); + assert!(s.execute("design.background", &json!({"transparency": 0.5, "index": bad})).is_err()); + assert_eq!(s.doc().unwrap().doc.slides[0].background, before); + } +} From 84ac51a43953a11b5b1c3327b8a6c32e4d4e7951 Mon Sep 17 00:00:00 2001 From: DominicTheD3v <119626487+DominicTheD3v@users.noreply.github.com> Date: Sat, 31 Oct 2026 07:04:09 +0000 Subject: [PATCH 038/716] fix: addressing more issues --- crates/engine/src/tests.rs | 60 +++++++++++++++++++++++++++++++++ crates/engine/src/tools/drag.rs | 14 +++++++- 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index ef18a31f6..39c04610e 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -5617,6 +5617,66 @@ fn resizing_selected_shapes_still_snaps_to_stationary_shapes() { assert_eq!(box_of(&mut s, fixed), fixed_before); } +/// Secondary pictures resize uniformly around their anchor, preserving independent flips +/// and keeping the complete multi-selection resize in one undo step. +#[test] +fn resizing_selected_shapes_resizes_secondary_pictures() { + // Pointer destination, Alt, expected rectangle, expected picture, expected flips. + let cases = [ + ((180.0, 200.0), false, [100.0, 100.0, 80.0, 100.0], [300.0, 300.0, 80.0, 80.0], [false, false]), + ((200.0, 180.0), false, [100.0, 100.0, 100.0, 80.0], [300.0, 300.0, 80.0, 80.0], [false, false]), + ((220.0, 200.0), false, [100.0, 100.0, 120.0, 100.0], [300.0, 300.0, 120.0, 120.0], [false, false]), + ((200.0, 220.0), false, [100.0, 100.0, 100.0, 120.0], [300.0, 300.0, 120.0, 120.0], [false, false]), + ((180.0, 200.0), true, [120.0, 100.0, 60.0, 100.0], [320.0, 320.0, 60.0, 60.0], [false, false]), + ((200.0, 180.0), true, [100.0, 120.0, 100.0, 60.0], [320.0, 320.0, 60.0, 60.0], [false, false]), + ((80.0, 200.0), false, [80.0, 100.0, 20.0, 100.0], [280.0, 300.0, 20.0, 20.0], [true, false]), + ((200.0, 80.0), false, [100.0, 80.0, 100.0, 20.0], [300.0, 280.0, 20.0, 20.0], [false, true]), + ]; + + for (to, alt, expected_rect, expected_picture, flips) in cases { + let mut s = session(); + s.execute("slide.new", &json!({"layout": "blank"})).unwrap(); + s.prefs.smart_guides = false; + s.prefs.snap_to_grid = false; + + let rect = s.execute("shape.insert", &json!({"preset": "rect", "rect": [100, 100, 100, 100]})).unwrap()["id"].as_u64().unwrap(); + let picture = ramp_picture(&mut s, 1, [300, 300, 100, 100]).as_u64().unwrap(); + s.execute("edit.select", &json!({"ids": [rect, picture]})).unwrap(); + + let before = s.doc().unwrap().doc.clone(); + let steps = s.doc().unwrap().history.undo.len(); + let mods = Mods { alt, ..Default::default() }; + let ev = |kind, (x, y): (f64, f64)| PointerEvent { kind, x, y, mods, tol: 3.0, pressure: None }; + + let down = s.pointer(ev(PointerKind::Down, (200.0, 200.0))).unwrap(); + assert_eq!(down["hit"]["kind"], "resize"); + assert_eq!(down["hit"]["id"], rect); + assert_eq!(down["hit"]["handle"], 4); + + s.pointer(ev(PointerKind::Drag, ((200.0 + to.0) / 2.0, (200.0 + to.1) / 2.0))).unwrap(); + s.pointer(ev(PointerKind::Drag, to)).unwrap(); + s.pointer(ev(PointerKind::Up, to)).unwrap(); + + for (id, expected) in [(rect, expected_rect), (picture, expected_picture)] { + let actual = box_of(&mut s, id); + for (key, value) in ["x", "y", "w", "h"].into_iter().zip(expected) { + let got = actual[key].as_f64().unwrap(); + assert!((got - value).abs() < 1e-9, "{to:?}, alt={alt}, shape={id}, {key}: expected {value}, got {got}"); + } + + let xfrm = s.doc().unwrap().shape(ShapeId(id as u32)).unwrap().xfrm.unwrap(); + assert_eq!([xfrm.flip_h, xfrm.flip_v], flips, "{to:?}, alt={alt}, shape={id}"); + } + + assert_eq!(s.doc().unwrap().history.undo.len(), steps + 1); + let after = s.doc().unwrap().doc.clone(); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(s.doc().unwrap().doc, before); + s.execute("edit.redo", &json!({})).unwrap(); + assert_eq!(s.doc().unwrap().doc, after); + } +} + /// #961: dragging the east handle snaps the dragged (right) edge, even when the fixed left edge /// already lines up with another shape. The nearest line used to be the fixed edge's, at distance 0. #[test] diff --git a/crates/engine/src/tools/drag.rs b/crates/engine/src/tools/drag.rs index 9b672ffcd..11392c13d 100644 --- a/crates/engine/src/tools/drag.rs +++ b/crates/engine/src/tools/drag.rs @@ -47,12 +47,24 @@ impl Session { let target_nx = if *tid == id { nx } else { + let picture = self.is_picture(*tid); + let (sx, sy) = if picture && matches!(handle, 0 | 2 | 4 | 6) { + // Use the axis with the larger relative change so an unchanged + // dimension cannot cancel shrinking. Preserve each axis's flip. + let scale_x = 1.0 + sx; + let scale_y = 1.0 + sy; + let scale = if sx.abs() >= sy.abs() { scale_x.abs() } else { scale_y.abs() }; + (scale.copysign(scale_x) - 1.0, scale.copysign(scale_y) - 1.0) + } else { + (sx, sy) + }; + let lp = Affine::rotate(o.rot.to_radians()) * Point::new( hx * sx * o.w / div * if o.flip_h { -1.0 } else { 1.0 }, hy * sy * o.h / div * if o.flip_v { -1.0 } else { 1.0 }, ); - resize_box(o, handle, Vec2::new(lp.x, lp.y), self.is_picture(*tid), mods.alt) + resize_box(o, handle, Vec2::new(lp.x, lp.y), picture, mods.alt) }; self.set_xfrm(*tid, target_nx)?; } From c5ac1dd44bb4bfe19777190fc98bd589d1fb26e2 Mon Sep 17 00:00:00 2001 From: DominicTheD3v <119626487+DominicTheD3v@users.noreply.github.com> Date: Sat, 31 Oct 2026 07:52:55 +0000 Subject: [PATCH 039/716] docs: add missing docstrings --- crates/engine/src/tools/drag.rs | 1 + crates/engine/src/tools/pointer.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/crates/engine/src/tools/drag.rs b/crates/engine/src/tools/drag.rs index 11392c13d..dcee9cf7d 100644 --- a/crates/engine/src/tools/drag.rs +++ b/crates/engine/src/tools/drag.rs @@ -13,6 +13,7 @@ struct MoveDrag { } impl Session { + /// Update the active drag interaction using the pointer position and modifiers. pub(super) fn drag(&mut self, p: Point, mods: Mods, tol: f64) -> Result { let Some(drag) = self.tool.drag.clone() else { return Ok(Value::Null) }; match drag { diff --git a/crates/engine/src/tools/pointer.rs b/crates/engine/src/tools/pointer.rs index 1f4cba0c5..d049dcf35 100644 --- a/crates/engine/src/tools/pointer.rs +++ b/crates/engine/src/tools/pointer.rs @@ -220,6 +220,7 @@ impl Session { } } + /// Handle a pointer press and start the applicable tool interaction. fn down(&mut self, p: Point, mods: Mods, tol: f64) -> Result { if let Some(Drag::Freeform { mode, mut points, .. }) = self.tool.drag.clone() { // Next click of a freeform: close on the start point, else add a vertex. @@ -440,6 +441,7 @@ impl Session { Ok(json!({"hit": serde_json::to_value(&hit).unwrap_or_default()})) } + /// Handle a pointer release and finalize the active tool interaction. fn up(&mut self, p: Point, mods: Mods) -> Result { let drag = self.tool.drag.take(); self.tool.guides.clear(); From 2ed2ce18d8e229e95776068e73daffb194f9fd96 Mon Sep 17 00:00:00 2001 From: Madhasoeki Date: Sat, 31 Oct 2026 22:25:50 +0700 Subject: [PATCH 040/716] Fonts: unavailable monospace fonts fall back to a monospace substitute (#1598) When a document uses a monospace font that is not installed on the system (such as Cousine, Source Code Pro, JetBrains Mono, Consolas, or Cascadia Code), document_face previously fell back to the generic proportional MISSING_FONT_FAMILY (Calibri), causing code snippets and columns to misalign. Add is_monospace_family to recognize monospace families, ensure substitutes returns open monospace replacements (Liberation Mono, Courier New, Menlo, Courier, DejaVu Sans Mono), recognize Cousine as a metric twin of Courier New, and keep monospace families on their substitute chain in document_face. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- crates/fonts/src/fontdb.rs | 80 ++++++++++++++++++++++++++++++++++++-- crates/fonts/src/lib.rs | 3 +- crates/fonts/src/tests.rs | 51 ++++++++++++++++++++++++ 3 files changed, 129 insertions(+), 5 deletions(-) diff --git a/crates/fonts/src/fontdb.rs b/crates/fonts/src/fontdb.rs index 043b8f2dd..cc2bd417a 100644 --- a/crates/fonts/src/fontdb.rs +++ b/crates/fonts/src/fontdb.rs @@ -30,12 +30,15 @@ pub fn bundled() -> Vec<&'static [u8]> { /// Open substitutes for families documents often ask for but we can't ship (metric-compatible /// where one exists), tried in order after the family itself. pub fn substitutes(family: &str) -> &'static [&'static str] { - match family.to_ascii_lowercase().as_str() { + let f = family.to_ascii_lowercase(); + if is_monospace_family(&f) { + return &["Liberation Mono", "Courier New", "Menlo", "Courier", "DejaVu Sans Mono"]; + } + match f.as_str() { "calibri" | "calibri light" => &["Carlito", "Liberation Sans", "Arial", "Inter"], "cambria" | "cambria math" => &["Caladea", "Liberation Serif", "Times New Roman", "Merriweather"], "arial" | "helvetica" | "helvetica neue" | "arial nova" => &["Liberation Sans", "Arial", "Helvetica Neue", "Helvetica", "Inter"], "times new roman" | "times" => &["Liberation Serif", "Times New Roman", "Times", "Merriweather"], - "courier new" | "courier" | "consolas" | "menlo" => &["Liberation Mono", "Courier New", "Menlo", "Courier"], "aptos" | "aptos display" | "aptos narrow" | "segoe ui" | "segoe ui light" | "segoe ui semibold" | "tahoma" | "verdana" => { &["Inter", "Helvetica Neue", "Arial", "Liberation Sans"] } @@ -52,12 +55,75 @@ pub fn substitutes(family: &str) -> &'static [&'static str] { } } +/// Families that are monospaced: when not installed, documents keep a monospaced substitute +/// ([`substitutes`]) so code blocks and columns stay aligned instead of falling back to +/// proportional Calibri. +pub fn is_monospace_family(family: &str) -> bool { + let f = family.to_ascii_lowercase(); + let s = f.trim(); + if matches!( + s, + "courier new" + | "courier" + | "cousine" + | "consolas" + | "menlo" + | "monaco" + | "source code pro" + | "jetbrains mono" + | "cascadia code" + | "cascadia mono" + | "fira code" + | "fira mono" + | "inconsolata" + | "dejavu sans mono" + | "sf mono" + | "roboto mono" + | "hack" + | "ubuntu mono" + | "pt mono" + | "liberation mono" + | "andale mono" + | "lucida console" + | "lucida sans typewriter" + | "fixedsys" + | "terminal" + | "monospace" + | "iosevka" + | "monolisa" + | "envy code r" + | "hasklig" + ) { + return true; + } + s.starts_with("courier") + || s.starts_with("consolas") + || s.starts_with("inconsolata") + || s.starts_with("iosevka") + || s.ends_with(" mono") + || s.ends_with(" code") + || s.ends_with(" console") + || s.ends_with(" typewriter") + || s.ends_with(" monospace") + || s.split_whitespace().any(|w| w == "mono" || w == "code" || w == "terminal" || w == "monospace") +} + /// Families whose open substitutes ([`substitutes`]) keep their metrics, so text drawn with /// them breaks into the same lines. fn has_metric_twin(family: &str) -> bool { matches!( family.to_ascii_lowercase().as_str(), - "calibri" | "calibri light" | "cambria" | "cambria math" | "arial" | "helvetica" | "times new roman" | "times" | "courier new" | "courier" + "calibri" + | "calibri light" + | "cambria" + | "cambria math" + | "arial" + | "helvetica" + | "times new roman" + | "times" + | "courier new" + | "courier" + | "cousine" ) } @@ -1080,9 +1146,15 @@ impl FontDb { /// when it is installed or bundled, or a metric-compatible stand-in (Carlito for Calibri, /// Liberation Sans for Arial…), or the family PowerPoint maps it to (Liberation Sans as Arial, /// see `office_twin`); any other missing family is drawn in Calibri (or Carlito). + /// Monospaced families keep a monospaced substitute instead of falling back to Calibri. /// DeckCraft's own default family keeps [`FontDb::face`]'s fallbacks. pub fn document_face(&self, family: &str, style: &str) -> Arc { - if family.eq_ignore_ascii_case(FALLBACK_FAMILY) || has_metric_twin(family) || is_office_cloud_font(family) || self.has_family(family) { + if family.eq_ignore_ascii_case(FALLBACK_FAMILY) + || has_metric_twin(family) + || is_monospace_family(family) + || is_office_cloud_font(family) + || self.has_family(family) + { return self.face(family, style); } if let Some(twin) = office_twin(family) { diff --git a/crates/fonts/src/lib.rs b/crates/fonts/src/lib.rs index 92d2cb44d..0bb0edb50 100644 --- a/crates/fonts/src/lib.rs +++ b/crates/fonts/src/lib.rs @@ -15,7 +15,8 @@ mod shape; pub use fallback::{bundled_families, covers_cluster, is_emoji_cluster, ligature_carets}; pub use fontdb::{ - FALLBACK_FAMILY, FaceRef, FontDb, FontFace, LAST_RESORT_FAMILY, MISSING_FONT_FAMILY, base_style, bundled, substitutes, system_font_dirs, + FALLBACK_FAMILY, FaceRef, FontDb, FontFace, LAST_RESORT_FAMILY, MISSING_FONT_FAMILY, base_style, bundled, is_monospace_family, substitutes, + system_font_dirs, }; pub use harfrust::Feature; use harfrust::Tag; diff --git a/crates/fonts/src/tests.rs b/crates/fonts/src/tests.rs index a6fca4c4d..69f54227d 100644 --- a/crates/fonts/src/tests.rs +++ b/crates/fonts/src/tests.rs @@ -237,6 +237,57 @@ fn office_fonts_have_substitutes() { assert!(substitutes("Times New Roman").contains(&"Liberation Serif")); assert!(substitutes("Aptos").contains(&"Inter")); assert!(substitutes("zzz").is_empty()); + + for mono in [ + "Courier New", + "Cousine", + "Consolas", + "Menlo", + "Monaco", + "Source Code Pro", + "JetBrains Mono", + "Cascadia Code", + "Cascadia Mono", + "Fira Code", + "Inconsolata", + "DejaVu Sans Mono", + "Roboto Mono", + "Hack", + "Ubuntu Mono", + "Custom Monospace", + "Fantasque Sans Mono", + ] { + assert!(substitutes(mono).contains(&"Liberation Mono"), "{mono} should have Liberation Mono substitute"); + assert!(is_monospace_family(mono), "{mono} should be recognized as monospace"); + } + + for prop in ["Calibri", "Arial", "Times New Roman", "Inter", "Monotype Corsiva", "Monotype Baskerville", "zzz"] { + assert!(!is_monospace_family(prop), "{prop} should not be recognized as monospace"); + } +} + +#[test] +fn missing_monospace_fonts_keep_monospace_fallback() { + let db = FontDb::global(); + let mono_sub = db.face("Unavailable JetBrains Mono", "Regular").family.clone(); + let calibri_target = db.face(MISSING_FONT_FAMILY, "Regular").family.clone(); + + assert!(is_monospace_family(&mono_sub), "substitute {mono_sub} must be monospace"); + + // Cousine is metric-compatible with Courier New / Liberation Mono and must not fall back to Calibri. + if !db.has_family("Cousine") { + assert_eq!(db.document_face("Cousine", "Regular").family, mono_sub); + } + + // Monospace fonts missing from the system must resolve to a monospace substitute. + for mono in ["Unavailable JetBrains Mono", "Custom App Code", "Unknown Space Mono", "Mock Terminal Font"] { + let f = db.document_face(mono, "Regular"); + assert_eq!(f.family, mono_sub, "{mono}"); + assert!(is_monospace_family(&f.family), "{mono} must resolve to a monospace family"); + if mono_sub != calibri_target { + assert_ne!(f.family, calibri_target, "{mono} must not fall back to Calibri"); + } + } } #[test] From cd19752bb5007c8f3c2a8661996b59e24d537f51 Mon Sep 17 00:00:00 2001 From: Elliot Graham Date: Sat, 31 Oct 2026 19:38:08 +0000 Subject: [PATCH 041/716] FIX-1621: let no-fill interiors pass clicks to underlying objects --- ROADMAP.md | 4 +- crates/engine/src/tests.rs | 114 +++++++++++++++++++++++++++++++++ crates/engine/src/tools/hit.rs | 7 +- docs/gaps.md | 3 +- docs/parity-checklist.md | 10 ++- docs/ui-parity.md | 5 +- 6 files changed, 136 insertions(+), 7 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index f92554c14..8dc52dfb7 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,7 +2,7 @@ **Stage: alpha** · next: beta, ~20 points and ~120–210 h away -> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-30 · **Change:** trivial (print-preview tests use egui's emitted URL, and macOS removes its previews before exit; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) +> **Last reviewed:** 2026-10-31 · **Last updated:** 2026-10-31 · **Change:** trivial (No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-30 · **Change:** trivial (progress log: read-only `slide.actions` lists shape and table text actions; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-27 · **Change:** trivial (progress log: Set Up Slide Show ▸ Keep mouse cursor visible, #1445; stage and scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-26 · **Change:** trivial (progress log: dragging several selected slides moves them all; previous: trivial, progress log: Edit Points handle drags with Shift, Ctrl/Cmd or Alt/Option set the point type; previous: trivial, progress log: scroll bars on the zoomed slide pane, #1157; previous: minor, native chart payloads stored in bounded ZIP members; previous: major, community PR wave 2026-10-14: ~60 landed items in the progress log, among them the Font, Paragraph, Photo Album, theme colour and font and Date and Time dialogs, presenter and show controls, the SmartArt Text Pane and PPTX corpus slices; breadth 84% after `cargo xtask parity`, ready stays ~55%, stage stays alpha; duplicated rows and headers folded; previous: minor, hours to ~95% per audience added) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) @@ -148,6 +148,7 @@ app's JSON control channel (`deckcraft --control PORT`). | Date | What landed | |---|---| +| 2026-10-31 | No Fill shape interiors allow selection and editing of underlying objects, even when a quick style remains; hit-testing uses the renderer’s fill resolution. Outlines, rotation, text targets and actual fills keep their hit behaviour (#1621) | | 2026-10-30 | Print-preview tests use the URL emitted by egui and its exact file path; previews are explicitly removed before the macOS process exits | | 2026-10-30 | `slide.actions` lists shape click and hover actions and text-run hyperlinks (including table cells and grouped shapes) for audit; listing never runs an action. The UI pane is a follow-up | | 2026-10-29 | Slide Show: going back to the previous slide plays the transition of the slide being left, reversed, as PowerPoint does, instead of the previous slide's own entrance transition (#1531); a jump (Go to Slide, links) still plays the target slide's transition | @@ -318,6 +319,7 @@ app's JSON control channel (`deckcraft --control PORT`). | Date | Change | Summary | |---|---|---| +| 2026-10-31 | trivial | No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged | | 2026-10-30 | trivial | Progress log: read-only slide action inspection; parity scores unchanged | | 2026-10-29 | trivial | Progress log: going back in the slide show reverses the left slide's transition (#1531). Scores and milestone names unchanged | | 2026-10-29 | trivial | Progress log: the Picture Styles row leaves room for Crop and Size (#1232). Scores and milestone names unchanged | diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index a687de95c..08417b4f8 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -5572,6 +5572,120 @@ fn edit_points_conversion_is_one_undo_step() { assert!(preset(&s), "the only step was the conversion"); } +// #1621: No Fill changes hit-testing as well as rendering, even with a quick style. +fn no_fill_overlap(s: &mut Session, text: bool) -> (ShapeId, ShapeId) { + s.execute("slide.new", &json!({"layout": "blank"})).unwrap(); + let under = s + .execute( + if text { "insert.textBox" } else { "shape.insert" }, + &json!({"preset": "rect", "rect": [100, 300, 300, 60], "text": if text { "UNDERLYING TEXT" } else { "" }}), + ) + .unwrap()["id"] + .as_u64() + .unwrap(); + let over = s.execute("shape.insert", &json!({"preset": "rect", "rect": [80, 270, 350, 140]})).unwrap()["id"].as_u64().unwrap(); + (ShapeId(under as u32), ShapeId(over as u32)) +} + +#[test] +fn no_fill_shape_allows_selecting_and_editing_underlying_text() { + let mut s = session(); + let (under, over) = no_fill_overlap(&mut s, true); + s.execute("shape.fill", &json!({"none": true})).unwrap(); + assert!(s.doc().unwrap().shape(over).unwrap().style.is_some(), "the ordinary quick style remains"); + s.execute("edit.deselect", &json!({})).unwrap(); + let p = deckcraft_geom::Point::new(200.0, 310.0); + assert!(matches!(s.hit_test(p, 3.0), Some(tools::Hit::Shape { id, .. }) if id == under)); + for kind in [PointerKind::Down, PointerKind::Up] { + s.pointer(tev(kind, p.x, p.y)).unwrap(); + } + assert_eq!(s.doc().unwrap().selection.shapes, vec![under]); + assert_eq!(text_sel(&s).unwrap().shape, under); + // The transparent foreground also leaves an already-active text editor's caret alone. + for kind in [PointerKind::Down, PointerKind::Up] { + s.pointer(tev(kind, p.x + 20.0, p.y)).unwrap(); + } + assert_eq!(text_sel(&s).unwrap().shape, under); + s.execute("edit.deselect", &json!({})).unwrap(); + // The rectangle's outline is still a target, and selecting it does not remove its style. + for kind in [PointerKind::Down, PointerKind::Up] { + s.pointer(tev(kind, 80.0, 330.0)).unwrap(); + } + assert_eq!(s.doc().unwrap().selection.shapes, vec![over]); + assert!(s.doc().unwrap().shape(over).unwrap().style.is_some()); + // A real fill still catches clicks, even with 100% transparency (distinct from No Fill). + for transparency in [0.0, 1.0] { + s.execute("edit.select", &json!({"ids": [over.0]})).unwrap(); + s.execute("shape.fill", &json!({"color": "#336699", "transparency": transparency})).unwrap(); + s.execute("edit.deselect", &json!({})).unwrap(); + assert!(matches!(s.hit_test(p, 3.0), Some(tools::Hit::Shape { id, .. }) if id == over)); + } +} + +#[test] +fn no_fill_shape_hit_testing_respects_rotation_and_pointer_tolerance() { + let mut s = session(); + let (under, over) = no_fill_overlap(&mut s, false); + s.execute("shape.fill", &json!({"none": true})).unwrap(); + s.execute("shape.rotate", &json!({"deg": 30})).unwrap(); + let x = s.doc().unwrap().shape(over).unwrap().xfrm.unwrap(); + let p = x.affine() * deckcraft_geom::Point::new(x.w / 2.0, x.h / 2.0); + let edge = x.affine() * deckcraft_geom::Point::new(0.0, x.h / 4.0); + for tol in [0.5, 3.0, 8.0] { + s.execute("edit.deselect", &json!({})).unwrap(); + assert!(matches!(s.hit_test(p, tol), Some(tools::Hit::Shape { id, .. }) if id == under)); + assert!(matches!(s.hit_test(edge, tol), Some(tools::Hit::Shape { id, .. }) if id == over)); + for kind in [PointerKind::Down, PointerKind::Up] { + s.pointer(PointerEvent { tol, ..tev(kind, p.x, p.y) }).unwrap(); + } + assert_eq!(s.doc().unwrap().selection.shapes, vec![under]); + } +} + +#[test] +fn no_fill_hit_testing_resolves_style_and_theme_fills() { + use std::sync::Arc; + for source in ["style", "theme", "absent"] { + let mut s = session(); + let (under, over) = no_fill_overlap(&mut s, true); + { + let st = s.doc_mut().unwrap(); + let doc = Arc::make_mut(&mut st.doc); + if source == "theme" { + Arc::make_mut(&mut doc.masters[0]).theme.format.fills[0] = model::Fill::None; + } + let sh = Arc::make_mut(&mut doc.slides[st.selection.slide]).shapes.iter_mut().find(|sh| sh.id == over).unwrap(); + assert!(sh.fill.is_none(), "the shape has no explicit fill override"); + if source == "absent" { + sh.style = None; + } else { + sh.style.as_mut().unwrap().fill_ref.0 = if source == "style" { 0 } else { 1 }; + } + } + s.execute("edit.deselect", &json!({})).unwrap(); + let p = deckcraft_geom::Point::new(200.0, 310.0); + assert!(matches!(s.hit_test(p, 3.0), Some(tools::Hit::Shape { id, .. }) if id == under), "{source}"); + // An explicit fill takes precedence over the no-fill style/theme. + s.execute("edit.select", &json!({"ids": [over.0]})).unwrap(); + s.execute("shape.fill", &json!({"color": "#336699"})).unwrap(); + s.execute("edit.deselect", &json!({})).unwrap(); + assert!(matches!(s.hit_test(p, 3.0), Some(tools::Hit::Shape { id, .. }) if id == over), "{source}"); + } +} + +#[test] +fn no_fill_text_shapes_keep_their_interior_text_target() { + let mut s = session(); + let (_, over) = no_fill_overlap(&mut s, true); + s.execute("text.set", &json!({"id": over.0, "text": "FOREGROUND TEXT"})).unwrap(); + s.execute("shape.fill", &json!({"none": true})).unwrap(); + s.execute("edit.deselect", &json!({})).unwrap(); + let p = deckcraft_geom::Point::new(200.0, 310.0); + assert!(matches!(s.hit_test(p, 3.0), Some(tools::Hit::Shape { id, text: true }) if id == over)); + s.pointer(tev(PointerKind::DoubleClick, p.x, p.y)).unwrap(); + assert_eq!(text_sel(&s).unwrap().shape, over); +} + /// #931: while the text of a placeholder is being edited, a shape in front of it still takes a /// click (as in PowerPoint); a click on the text where nothing is in front still moves the caret. #[test] diff --git a/crates/engine/src/tools/hit.rs b/crates/engine/src/tools/hit.rs index 6a0da529f..0e4b6ddcb 100644 --- a/crates/engine/src/tools/hit.rs +++ b/crates/engine/src/tools/hit.rs @@ -267,8 +267,11 @@ pub(super) fn hit_shape(st: &crate::DocState, sh: &Shape, p: Point, tol: f64) -> return None; } let has_text = matches!(sh.kind, ShapeKind::Shape) && (sh.text.as_ref().is_some_and(|t| !t.is_empty()) || sh.ph.is_some() || sh.text_box); - // Empty interiors of unfilled, text-less shapes don't catch clicks. - let filled = !matches!(sh.fill, Some(deckcraft_model::Fill::None)) || sh.style.is_some(); + // Match rendering: an explicit No Fill overrides the style, and style/theme fills + // can themselves be No Fill. Empty, text-less interiors then let clicks through. + let fill = + cmd::text::ctx_for(&st.doc, &st.selection).map(|ctx| deckcraft_model::resolve::fill(&ctx, sh).0).unwrap_or_else(|| sh.fill.clone()); + let filled = !matches!(fill, None | Some(deckcraft_model::Fill::None)); let geo = deckcraft_render::shape_geometry(sh, x.w, x.h); let in_geo = { use deckcraft_geom::KurboShape; diff --git a/docs/gaps.md b/docs/gaps.md index 29edfd573..3bc26cce7 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Where DeckCraft falls short of PowerPoint -> **Last reviewed:** 2026-10-30 · **Last updated:** 2026-10-30 · **Change:** minor (slide-show hit testing follows each shape’s own animation state; scale and rotation covered; previous: trivial, AutoFormat lists run independently of Replace text as you type; previous: minor, slide-show click targets follow animated shapes and text links; previous: minor, Animation Pane ▸ Play From; previous: minor, native chart payloads stored in bounded ZIP members; previous: major, community PR wave 2026-10-14: soak tests, PPTX corpus, comment threads (#70), embedded fonts, SmartArt Text Pane, Animation Pane timeline, Hunspell spelling, thesaurus, AutoCorrect, 14 new dialogs, pen pressure and trackpad gestures; duplicated entries and headers folded; previous: minor, 3-D bevel, camera and face lighting rendered) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) +> **Last reviewed:** 2026-10-31 · **Last updated:** 2026-10-31 · **Change:** trivial (No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) Every known shortfall, one entry each, ranked by how much it stops someone who presents with PowerPoint from switching. This is the work list: pick from the top. Numbers are summarized in @@ -368,6 +368,7 @@ Detail in [localization-parity.md](localization-parity.md). | Date | Change | Summary | |---|---|---| +| 2026-10-31 | trivial | No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged | | 2026-10-30 | minor | Slide-show click targets use each shape’s own animation state; scale and rotation test added | | 2026-10-28 | trivial | Automatic lists now run independently of Replace text as you type; proofing gap description updated | | 2026-10-27 | minor | Refreshed against merged PRs: removed the Morph alignment entry (#67 merged 2026-10-14); #77 (animation rewind, PR #83) is fixed, leaving #74 in the round-trip gap; #75 was closed unmerged, so #60 stays open with no fix PR; #53 is closed and the image-paste gap is now Windows #1414; Reuse Slides (#1103) and Compare reject (#850) noted in the smaller rows; the duplicate header line is gone | diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index 0c0d3ec60..c088bd018 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -2,6 +2,8 @@ > **Generated:** 2026-10-14 (bullets/numbering remain D after empty-line marker review; summary by `cargo xtask parity`; rows re-scored by the 2026-10-14 community PR wave, duplicate Thesaurus, AutoCorrect, Artistic effects and Corrections rows folded; Preview in editor re-scored 2026-10-13; earlier rows re-scored 2026-10-10 against PowerPoint for Mac 16.113.4; video/animated GIF row re-scored 2026-10-11, #171) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) +> **Last updated:** 2026-10-31 · Fill row re-assessed after #1621: remains D; No Fill hit-testing now follows resolved appearance. Scores unchanged. + The summary between ` **Weighted breadth parity: 84%** over 191 features. @@ -118,7 +120,7 @@ Open P0 items: Contextual tabs (Shape Format, Picture Format, Table Design/Layou | Shapes | Text warp transforms | P2 | P | | Shapes | Shape quick styles | P1 | D | | Shapes | Set as default shape | P2 | D | -| Format | Solid fill and transparency | P0 | D | +| Format | Solid fill and transparency (No Fill interiors pass clicks through, #1621) | P0 | D | | Format | Gradient fill (linear, radial, rectangular, path) | P0 | D | | Format | Picture and texture fill | P1 | P | | Format | Pattern fill | P2 | P | @@ -233,3 +235,9 @@ Open P0 items: Contextual tabs (Shape Format, Picture Format, Table Design/Layou | Platforms (✱) | macOS, Windows, Linux builds | P0 | P | | Platforms (✱) | Web (WASM) build | P1 | D | | Platforms (✱) | BSD build | P2 | P | + +## Revision history + +| Date | Change | Summary | +|---|---|---| +| 2026-10-31 | trivial | No Fill interior hit-testing follows resolved fill (#1621); fill row remains D and summary scores are unchanged | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 1e2ef52f4..fa5f9ae88 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI parity with PowerPoint -> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-29 · **Change:** trivial (Picture Format: the Picture Styles row leaves room for Crop and Size, #1232; previous: trivial, Edit Points: Shift, Ctrl/Cmd or Alt/Option on a handle drag sets the point type; previous: trivial, scroll bars on the zoomed slide pane, #1157; previous: major, community PR wave 2026-10-14: 14 new dialogs (41 in all), Eyedropper, Export button, New Window, Grid Options, WordArt gallery and handles, Slide Sorter sections, Quick Access Toolbar, Format Background and Format Shape depth, rich-text clipboard; duplicated rows and headers folded; previous: minor, File tab / Backstage, #76) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) +> **Last reviewed:** 2026-10-31 · **Last updated:** 2026-10-31 · **Change:** trivial (No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-26 · **Change:** trivial (dragging several selected slides moves them all; previous: trivial, Edit Points: Shift, Ctrl/Cmd or Alt/Option on a handle drag sets the point type; previous: trivial, scroll bars on the zoomed slide pane, #1157; previous: major, community PR wave 2026-10-14: 14 new dialogs (41 in all), Eyedropper, Export button, New Window, Grid Options, WordArt gallery and handles, Slide Sorter sections, Quick Access Toolbar, Format Background and Format Shape depth, rich-text clipboard; duplicated rows and headers folded; previous: minor, File tab / Backstage, #76) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-22 · **Change:** trivial (group fill and outline edits reach members, #1079; scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-24 · **Change:** trivial (Edit Points: Shift, Ctrl/Cmd or Alt/Option on a handle drag sets the point type; previous: trivial, scroll bars on the zoomed slide pane, #1157; previous: major, community PR wave 2026-10-14: 14 new dialogs (41 in all), Eyedropper, Export button, New Window, Grid Options, WordArt gallery and handles, Slide Sorter sections, Quick Access Toolbar, Format Background and Format Shape depth, rich-text clipboard; duplicated rows and headers folded; previous: minor, File tab / Backstage, #76) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) @@ -81,7 +81,7 @@ menu colours taken from the theme tokens (menu `chrome`, page `card`). | Behaviour | PowerPoint | DeckCraft | |---|---|---| -| Selection handles, rotation handle, yellow adjustment handles | yes | yes | +| Selection handles, rotation handle, yellow adjustment handles | yes | yes; an empty No Fill shape passes interior clicks to underlying objects while its outline and handles remain selectable. Explicit, style and theme fills resolve as rendered (#1621) | | Marquee, Shift/Cmd multi-select, Tab to cycle | yes | yes | | Objects off the slide: drawn on the area around it in Normal view (full strength, master graphics too), selectable and movable there; clipped in the show, exports and thumbnails | yes | yes (#270) | | Scroll bars on the slide pane when the zoomed slide is larger than the window | yes | yes, on each axis that overflows: drag the thumb or click the track; the wheel and trackpad still pan. The vertical bar does not turn the page (#1157) | @@ -171,6 +171,7 @@ consistency is open (#73, #56). | Date | Change | Summary | |---|---|---| +| 2026-10-31 | trivial | No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged | | 2026-10-29 | trivial | Picture Format: the Picture Styles row shows as many styles as fit beside the groups after it (at least two) and a More arrow with all 24, as the Transitions and Animations galleries do; Crop and Size are in view in the default window (#1232) | | 2026-10-26 | trivial | Thumbnail pane and Slide Sorter: dragging one of several selected slides moves the whole selection | | 2026-10-24 | trivial | Table cells: dragging across cells selects a range of cells | From d990678b32609e7f7301be4f389481c83c7eba96 Mon Sep 17 00:00:00 2001 From: Simon Koch-Sultan <126534658+scks1@users.noreply.github.com> Date: Sat, 31 Oct 2026 17:18:44 -0400 Subject: [PATCH 042/716] render: keep even-odd holes open in shadow, glow and reflection silhouettes effects_below merged all subpaths into one silhouette and filled it with the NonZero rule, discarding each subpath's even_odd flag, so the holes of donut, frame and similar preset shapes filled in under outer shadows, glows and reflections. Fill each participating subpath under its own fill rule at the three effect fill sites, mirroring fill_geometry; the glow stroke keeps the merged silhouette. Fixes #1596. The picture-content shadow clip path is unchanged (that is #1597's territory). --- crates/render/src/renderer.rs | 42 ++++++++++++++++++++++++----- crates/render/src/tests.rs | 50 +++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 7 deletions(-) diff --git a/crates/render/src/renderer.rs b/crates/render/src/renderer.rs index 84c5e5a8f..c25f6bab6 100644 --- a/crates/render/src/renderer.rs +++ b/crates/render/src/renderer.rs @@ -1125,12 +1125,15 @@ impl Renderer { // see-through as its fill (none for an outline-only shape) … None => { if let Some(a) = fill_alpha { - let mut filled = BezPath::new(); - for sp in geo.paths.iter().filter(|sp| sp.fill != FillMode::None) { - filled.extend(sp.path.iter()); - } ctx.set_paint(color(c.with_alpha(255), a)); - ctx.fill_path(&filled); + // Each subpath under its own fill rule, as the shape itself is + // drawn: one merged path filled NonZero fills the hole of an + // even-odd shape (a donut, a frame) (#1596). + for sp in geo.paths.iter().filter(|sp| sp.fill != FillMode::None) { + ctx.set_fill_rule(if sp.even_odd { peniko::Fill::EvenOdd } else { peniko::Fill::NonZero }); + ctx.fill_path(&sp.path); + } + ctx.set_fill_rule(peniko::Fill::NonZero); } } } @@ -1161,7 +1164,19 @@ impl Renderer { ctx.stroke_path(&silhouette); // A shape without a fill (an outline, a frame) glows along its line only (#225). if fill_alpha.is_some() || content.is_some() { - ctx.fill_path(&silhouette); + // Per subpath under its own fill rule, as in the shadow above: the + // merged silhouette filled NonZero fills an even-odd hole (#1596). + // When no subpath takes part the silhouette is the outline fallback. + let mut filled_any = false; + for sp in geo.paths.iter().filter(|sp| sp.fill != FillMode::None || fill.is_none()) { + ctx.set_fill_rule(if sp.even_odd { peniko::Fill::EvenOdd } else { peniko::Fill::NonZero }); + ctx.fill_path(&sp.path); + filled_any = true; + } + if !filled_any { + ctx.fill_path(&silhouette); + } + ctx.set_fill_rule(peniko::Fill::NonZero); } ctx.pop_layer(); } @@ -1180,7 +1195,20 @@ impl Renderer { } None => { if let Some(fl) = fill { - paint::fill_path(ctx, rctx, fl, ph, &silhouette, Rect::new(0.0, 0.0, w, h), mm, FillMode::Norm, 1.0, rctx.pres); + // Per subpath under its own fill rule, as in the shadow above: + // the merged silhouette filled NonZero fills an even-odd hole + // (#1596). The outline fallback covers shapes with no + // participating subpath. + let mut filled_any = false; + for sp in geo.paths.iter().filter(|sp| sp.fill != FillMode::None || fill.is_none()) { + ctx.set_fill_rule(if sp.even_odd { peniko::Fill::EvenOdd } else { peniko::Fill::NonZero }); + paint::fill_path(ctx, rctx, fl, ph, &sp.path, Rect::new(0.0, 0.0, w, h), mm, FillMode::Norm, 1.0, rctx.pres); + filled_any = true; + } + if !filled_any { + paint::fill_path(ctx, rctx, fl, ph, &silhouette, Rect::new(0.0, 0.0, w, h), mm, FillMode::Norm, 1.0, rctx.pres); + } + ctx.set_fill_rule(peniko::Fill::NonZero); } } } diff --git a/crates/render/src/tests.rs b/crates/render/src/tests.rs index f01ee1cf8..2de2daabe 100644 --- a/crates/render/src/tests.rs +++ b/crates/render/src/tests.rs @@ -515,6 +515,56 @@ fn glow_of_a_shape_with_no_fill_and_no_line_is_not_drawn() { } } +#[test] +fn shadow_and_glow_keep_an_even_odd_shapes_hole() { + // #1596: a donut is one even-odd subpath — its hole exists only under the + // even-odd rule. The effects were cast from a merged silhouette filled + // NonZero, so the shadow and the glow filled the hole solid. The hole's + // centre must stay the slide's white in both, while the effects still draw. + let donut = |effects: deckcraft_model::Effects| { + let mut sh = Shape { + id: ShapeId(612), + xfrm: Some(Xfrm::new(50.0, 50.0, 200.0, 200.0)), + geom: Geom::preset("donut"), + fill: Some(Fill::solid(ColorRef::rgb(deckcraft_color::Rgba::rgb(255, 160, 0)))), + ..Default::default() + }; + sh.effects = Some(effects); + render_slide(&deck_with(vec![sh]), 0, &RenderOpts { scale: 1.0, ..Default::default() }) + }; + let img = donut(deckcraft_model::Effects { + outer_shadow: Some(deckcraft_model::style::Shadow { + color: ColorRef::rgb(deckcraft_color::Rgba::BLACK), + blur: 8.0, + dist: 0.0, + dir: 45.0, + inner: false, + sx: 1.0, + sy: 1.0, + kx: 0.0, + ky: 0.0, + align: String::new(), + rotate_with_shape: false, + }), + ..Default::default() + }); + let hole = img.pixel(150, 150); + assert!(hole[0] > 245 && hole[1] > 245 && hole[2] > 245, "shadow in the hole: {hole:?}"); + // The shadow still falls around the shape (just below its bottom edge). + let below = img.pixel(150, 251); + assert!(below[0] < 200 && below[0] == below[2], "no shadow below: {below:?}"); + + let img = donut(deckcraft_model::Effects { + glow: Some(deckcraft_model::style::Glow { color: ColorRef::rgb(deckcraft_color::Rgba::rgb(255, 0, 0)), radius: 8.0 }), + ..Default::default() + }); + let hole = img.pixel(150, 150); + assert!(hole[0] > 245 && hole[1] > 245 && hole[2] > 245, "glow in the hole: {hole:?}"); + // The ring itself is the shape's orange. + let ring = img.pixel(150, 75); + assert!(ring[0] > 200 && ring[1] > 100 && ring[2] < 100, "ring: {ring:?}"); +} + #[test] fn placeholder_prompts_only_in_edit_view() { let p = Presentation::default(); From a1217166292752a75026c0d476038044f293076c Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Sun, 18 Oct 2026 23:31:04 -0500 Subject: [PATCH 043/716] [CC2] Style commands given none of their optional keys are refused shape.line, shape.effects, picture.adjust, format.paragraph and format.margins answered changed for a call that set nothing. They now say what to pass. shape.fill already refused; the toggles (bold, bullets) and geometry commands keep their meaningful defaults. Co-Authored-By: Claude Sonnet 5.5 --- crates/engine/src/cmd.rs | 15 +++++++++ crates/engine/src/cmd/format.rs | 6 ++-- crates/engine/src/cmd/format/paragraph.rs | 25 ++++++++++++++- crates/engine/src/cmd/shape.rs | 8 ++--- crates/engine/src/cmd/shape/appearance.rs | 12 ++++++- crates/engine/src/cmd/shape/picture.rs | 3 +- crates/engine/src/tests.rs | 38 +++++++++++++++++++++++ 7 files changed, 97 insertions(+), 10 deletions(-) diff --git a/crates/engine/src/cmd.rs b/crates/engine/src/cmd.rs index 6f20c4143..04e63f5bf 100644 --- a/crates/engine/src/cmd.rs +++ b/crates/engine/src/cmd.rs @@ -297,6 +297,16 @@ pub fn parse_params(doc: &str) -> std::result::Result>, String> { /// growing would duplicate ids (#407). pub(crate) const NO_ID_SPACE: &str = "the presentation has used every object id and can hold no more"; +/// A style command whose keys are all optional is refused when it is given none of them, rather +/// than answering `changed` for a call that sets nothing. +pub(crate) fn require_any(p: &Value, cmd: &str, keys: &[&str]) -> Result<()> { + if keys.iter().any(|k| p.get(*k).is_some_and(|v| !v.is_null())) { + return Ok(()); + } + let (last, rest) = keys.split_last().map_or(("", &[][..]), |(l, r)| (*l, r)); + Err(bad(cmd, format!("`{cmd}` was given nothing to set: pass {} or {last}", rest.join(", ")))) +} + pub(crate) fn bad(cmd: &str, msg: impl Into) -> EngineError { EngineError::BadParams { cmd: cmd.into(), msg: msg.into() } } @@ -534,6 +544,10 @@ pub(crate) fn current_names(doc: &deckcraft_model::Presentation, sel: &crate::Se /// A name ending in `?` is optional. Text after `→` is the result, not an input. pub fn needs_arguments(params: &str) -> bool { let input = params.split('→').next().unwrap_or(params); + // Every key optional, but the command refuses a call that gives none of them. + if input.contains("(at least one key)") { + return true; + } let Some(start) = input.find('{') else { return false }; let inside = input.get(start + 1..).unwrap_or(""); let inside = inside.split('}').next().unwrap_or(inside); @@ -657,6 +671,7 @@ mod tests { assert!(needs_arguments("{axis: horizontal|vertical, ids?}")); assert!(needs_arguments("{percent}")); assert!(!needs_arguments("{}")); + assert!(needs_arguments("{left?: pt, top?: pt} (at least one key)")); assert!(!needs_arguments("{on?: bool}")); assert!(!needs_arguments("{theme?: name, size?: [w,h] pt, blank?: bool}")); assert!(!needs_arguments("{uid?: one entry, else all}")); diff --git a/crates/engine/src/cmd/format.rs b/crates/engine/src/cmd/format.rs index 4e273dc1c..d96739a05 100644 --- a/crates/engine/src/cmd/format.rs +++ b/crates/engine/src/cmd/format.rs @@ -11,7 +11,7 @@ use std::sync::Arc; use super::text::{format_body, format_para, format_run, format_run_levels}; use super::{ CommandSpec, always, bad, base64_decode, bool_or, bool_param, cmd, color_param, edit_shapes, f64_or, f64_param, has_doc, has_text, - has_text_or_shapes, ids_param, ok, str_param, + has_text_or_shapes, ids_param, ok, require_any, str_param, }; use crate::{Result, Session}; use deckcraft_model::ShapeId; @@ -199,7 +199,7 @@ pub fn specs() -> Vec { "Paragraph…", ["Format"], None, - "{align?, indentLeft?: pt, indentFirst?: pt (negative = hanging), spaceBefore?: pt, spaceAfter?: pt, lineSpacing?: lines}", + "{align?, indentLeft?: pt, indentFirst?: pt (negative = hanging), spaceBefore?: pt, spaceAfter?: pt, lineSpacing?: lines, lineSpacingPt?: pt} (at least one key)", has_text_or_shapes, paragraph ), @@ -248,7 +248,7 @@ pub fn specs() -> Vec { "Text Box Margins", ["Format Shape", "Text Box"], None, - "{left?: pt, top?: pt, right?: pt, bottom?: pt}", + "{left?: pt, top?: pt, right?: pt, bottom?: pt} (at least one key)", has_text_or_shapes, margins ), diff --git a/crates/engine/src/cmd/format/paragraph.rs b/crates/engine/src/cmd/format/paragraph.rs index f036068f6..c508c3573 100644 --- a/crates/engine/src/cmd/format/paragraph.rs +++ b/crates/engine/src/cmd/format/paragraph.rs @@ -1,6 +1,6 @@ use super::{ Align, Anchor, AutoFit, Bullet, Result, Session, Spacing, TextDir, Value, bad, bool_or, color_param, current_para, f64_or, f64_param, - format_body, format_para, json, ok, on_param, resolve, str_param, + format_body, format_para, json, ok, on_param, require_any, resolve, str_param, }; pub(super) fn align_to(s: &mut Session, a: Align) -> Result { @@ -117,6 +117,28 @@ pub(super) fn line_spacing(s: &mut Session, p: &Value) -> Result { } pub(super) fn paragraph(s: &mut Session, p: &Value) -> Result { + if let Err(e) = + require_any(p, "format.paragraph", &["align", "indentLeft", "indentFirst", "spaceBefore", "spaceAfter", "lineSpacing", "lineSpacingPt"]) + { + // The Paragraph dialog's other fields are format.paragraphDialog's; say so instead of + // calling the call empty. + if let Some(k) = + ["special", "specialBy", "indentRight", "spaceBeforeKind", "spaceAfterKind"].into_iter().find(|k| p.get(*k).is_some_and(|v| !v.is_null())) + { + // The dialog applies a kind or `specialBy` only with the value it qualifies. + let with = match k { + "spaceBeforeKind" => " together with `spaceBefore`", + "spaceAfterKind" => " together with `spaceAfter`", + "specialBy" => " together with `special`", + _ => "", + }; + return Err(bad( + "format.paragraph", + format!("`{k}` is a field of format.paragraphDialog (the whole Paragraph dialog), given{with}; format.paragraph does not read it"), + )); + } + return Err(e); + } let a = str_param(p, "align").map(|a| match a { "center" => Align::Center, "right" => Align::Right, @@ -405,6 +427,7 @@ pub(super) fn wrap(s: &mut Session, p: &Value) -> Result { } pub(super) fn margins(s: &mut Session, p: &Value) -> Result { + require_any(p, "format.margins", &["left", "top", "right", "bottom"])?; let (l, t, r, b) = (f64_param(p, "left"), f64_param(p, "top"), f64_param(p, "right"), f64_param(p, "bottom")); format_body(s, &move |bp| { if l.is_some() { diff --git a/crates/engine/src/cmd/shape.rs b/crates/engine/src/cmd/shape.rs index 9565cdf7b..1d58dd254 100644 --- a/crates/engine/src/cmd/shape.rs +++ b/crates/engine/src/cmd/shape.rs @@ -10,7 +10,7 @@ use serde_json::{Value, json}; use super::{ CommandSpec, NO_ID_SPACE, bad, bool_or, bool_param, cmd, color_param, color_value, edit_geometry, edit_shapes, f64_param, has_selection, - has_slide, id_param, ok, str_param, targets, usize_param, with_param, xfrm_of, + has_slide, id_param, ok, require_any, str_param, targets, usize_param, with_param, xfrm_of, }; use crate::{Result, Session}; @@ -112,7 +112,7 @@ pub fn specs() -> Vec { "Shape Outline", ["Shape Format", "Shape Styles"], None, - "{color?, none?, width?: pt, dash?: solid|dot|dash|lgDash|dashDot|sysDot|sysDash, cap?: flat|round|square, join?: round|bevel|miter, compound?: single|double|thickThin|thinThick|triple, head?: none|triangle|stealth|diamond|oval|arrow, tail?, headSize?: sm|med|lg, tailSize?, reset?, ids?}; a group also formats its members", + "{color?, none?, width?: pt, dash?: solid|dot|dash|lgDash|dashDot|sysDot|sysDash, cap?: flat|round|square, join?: round|bevel|miter, compound?: single|double|thickThin|thinThick|triple, head?: none|triangle|stealth|diamond|oval|arrow, tail?, headSize?: sm|med|lg, tailSize?, reset?, ids?} (at least one key); a group also formats its members", has_selection, line ), @@ -121,7 +121,7 @@ pub fn specs() -> Vec { "Shape Effects", ["Shape Format", "Shape Styles"], None, - "{shadow?: none|outer|inner|perspective|{color, blur, dist, dir}, glow?: none|{color, radius}, softEdges?: pt, reflection?: none|tight|half|full, bevel?: none|circle|…, threeD?: {camera?: preset, rotX?, rotY?, rotZ?: deg, z?: pt, bevelTop?, bevelBottom?: none|circle|…, bevelTopW?, bevelTopH?, bevelBottomW?, bevelBottomH?, depth?, contour?: pt, material?, lighting?, reset?: true}, shadowProps?: {color?, transparency?: 0..1, size?: 0.01..2 (1 = 100%), blur?: pt, dist?: pt, dir?: deg}, glowProps?: {color?, transparency?, radius?: pt}, reflectionProps?: {transparency?, size?: 0..1, dist?: pt, blur?: pt}, reset?, ids?} (the *Props keys adjust the current effect, adding a default one when there is none)", + "{shadow?: none|outer|inner|perspective|{color, blur, dist, dir}, glow?: none|{color, radius}, softEdges?: pt, reflection?: none|tight|half|full, bevel?: none|circle|…, threeD?: {camera?: preset, rotX?, rotY?, rotZ?: deg, z?: pt, bevelTop?, bevelBottom?: none|circle|…, bevelTopW?, bevelTopH?, bevelBottomW?, bevelBottomH?, depth?, contour?: pt, material?, lighting?, reset?: true}, shadowProps?: {color?, transparency?: 0..1, size?: 0.01..2 (1 = 100%), blur?: pt, dist?: pt, dir?: deg}, glowProps?: {color?, transparency?, radius?: pt}, reflectionProps?: {transparency?, size?: 0..1, dist?: pt, blur?: pt}, reset?, ids?} (at least one key) (the *Props keys adjust the current effect, adding a default one when there is none)", has_selection, effects ), @@ -161,7 +161,7 @@ pub fn specs() -> Vec { "Corrections", ["Picture Format", "Adjust"], None, - "{brightness?: -1..1, contrast?: -1..1, saturation?: 0..4, grayscale?: bool, transparency?: 0..1, reset?: bool, ids?}", + "{brightness?: -1..1, contrast?: -1..1, saturation?: 0..4, grayscale?: bool, transparency?: 0..1, reset?: bool, ids?} (at least one key)", has_selection, picture_adjust ), diff --git a/crates/engine/src/cmd/shape/appearance.rs b/crates/engine/src/cmd/shape/appearance.rs index 24bfbabf8..0200ea10c 100644 --- a/crates/engine/src/cmd/shape/appearance.rs +++ b/crates/engine/src/cmd/shape/appearance.rs @@ -1,7 +1,7 @@ use super::{ ColorRef, ColorTransform, Dash, Effects, Fill, Geom, Glow, Gradient, GradientShape, GradientStop, Line, LineEnd, PictureFill, PictureMode, Reflection, Result, Rgba, SchemeSlot, Session, Shadow, ShapeStyle, Value, apply_fill, bad, bool_or, color_param, color_value, edit_geometry, - edit_shapes, f64_param, inherited_fills, json, requested_fill, str_param, targets, usize_param, + edit_shapes, f64_param, inherited_fills, json, requested_fill, require_any, str_param, targets, usize_param, }; pub(super) fn adjust(s: &mut Session, p: &Value) -> Result { @@ -236,6 +236,7 @@ fn line_end(v: &str) -> Option { } pub(super) fn line(s: &mut Session, p: &Value) -> Result { + require_any(p, "shape.line", &["color", "none", "width", "dash", "cap", "join", "compound", "head", "tail", "headSize", "tailSize", "reset"])?; let reset = bool_or(p, "reset", false); let none = bool_or(p, "none", false); let color = color_param(p, "color"); @@ -355,6 +356,15 @@ fn shadow_preset(v: &Value) -> Option> { } pub(super) fn effects(s: &mut Session, p: &Value) -> Result { + // `glow: null` and `softEdges: null` clear those effects (No Glow, No Soft Edges), so a null + // counts as something to set for them. + if !["glow", "softEdges"].iter().any(|k| p.get(*k).is_some()) { + require_any( + p, + "shape.effects", + &["shadow", "glow", "softEdges", "reflection", "bevel", "threeD", "shadowProps", "glowProps", "reflectionProps", "reset"], + )?; + } let reset = bool_or(p, "reset", false); let shadow = p.get("shadow").and_then(shadow_preset); let glow: Option> = p.get("glow").map(|g| match g { diff --git a/crates/engine/src/cmd/shape/picture.rs b/crates/engine/src/cmd/shape/picture.rs index 09cf22ae0..5db75277f 100644 --- a/crates/engine/src/cmd/shape/picture.rs +++ b/crates/engine/src/cmd/shape/picture.rs @@ -1,4 +1,4 @@ -use super::{NO_ID_SPACE, Result, Session, Value, bad, bool_or, bool_param, edit_geometry, edit_shapes, f64_param, json}; +use super::{NO_ID_SPACE, Result, Session, Value, bad, bool_or, bool_param, edit_geometry, edit_shapes, f64_param, json, require_any}; pub(super) fn crop(s: &mut Session, p: &Value) -> Result { let c = [f64_param(p, "left"), f64_param(p, "top"), f64_param(p, "right"), f64_param(p, "bottom")]; @@ -15,6 +15,7 @@ pub(super) fn crop(s: &mut Session, p: &Value) -> Result { } pub(super) fn picture_adjust(s: &mut Session, p: &Value) -> Result { + require_any(p, "picture.adjust", &["brightness", "contrast", "saturation", "grayscale", "transparency", "reset"])?; edit_shapes(s, p, "picture.adjust", |sh| { if let deckcraft_model::ShapeKind::Picture { fill } = &mut sh.kind { let a = &mut fill.adjust; diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index a687de95c..953322922 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -5970,6 +5970,44 @@ fn invalid_slide_index_never_falls_back_to_the_selection_in_export_commands() { let _ = std::fs::remove_dir_all(&dir); } +#[test] +fn style_commands_given_nothing_to_set_are_refused() { + let mut s = session(); + s.execute("insert.textBox", &json!({"text": "Hi", "rect": [50.0, 50.0, 200.0, 100.0]})).unwrap(); + for cmd in ["shape.line", "shape.effects", "picture.adjust", "format.paragraph", "format.margins"] { + let rev = s.doc().unwrap().revision; + let e = s.execute(cmd, &json!({})).unwrap_err().to_string(); + assert!(e.contains("given nothing to set") && e.contains(cmd), "{cmd}: {e}"); + assert_eq!(s.doc().unwrap().revision, rev, "{cmd} changed the deck"); + } + let e = s.execute("shape.line", &json!({})).unwrap_err().to_string(); + assert!(e.contains("pass color, none, width, dash"), "{e}"); + // A key, even one that changes nothing visible, is something to set. + s.execute("shape.line", &json!({"width": 2})).unwrap(); + s.execute("format.margins", &json!({"left": 5})).unwrap(); + // A null glow or soft edge clears it (No Glow, No Soft Edges): that is something to set. + let fx = |s: &Session| s.doc().unwrap().selected_shapes()[0].effects.clone().unwrap_or_default(); + s.execute("shape.effects", &json!({"glow": 8, "softEdges": 5})).unwrap(); + assert!(fx(&s).glow.is_some() && fx(&s).soft_edge.is_some()); + s.execute("shape.effects", &json!({"glow": null})).unwrap(); + assert!(fx(&s).glow.is_none() && fx(&s).soft_edge.is_some()); + s.execute("shape.effects", &json!({"softEdges": null})).unwrap(); + assert!(fx(&s).soft_edge.is_none()); + // The Paragraph dialog's own fields are format.paragraphDialog's, and the refusal says so. + for (k, v) in [("special", json!("hanging")), ("spaceBeforeKind", json!("pct")), ("indentRight", json!(10))] { + let e = s.execute("format.paragraph", &json!({ k: v })).unwrap_err().to_string(); + assert!(e.contains("format.paragraphDialog") && e.contains(k), "{k}: {e}"); + } + let e = s.execute("format.paragraph", &json!({"spaceBeforeKind": "pct"})).unwrap_err().to_string(); + assert!(e.contains("together with `spaceBefore`"), "{e}"); + // The palette lists only commands that run without arguments; these need one key. + for cmd in ["shape.line", "shape.effects", "picture.adjust", "format.paragraph", "format.margins"] { + let spec = crate::command_specs().iter().find(|c| c.id == cmd).unwrap(); + assert!(crate::cmd::needs_arguments(spec.params), "{cmd}: {}", spec.params); + } + s.execute("format.paragraphDialog", &json!({"special": "hanging", "specialBy": 18})).unwrap(); +} + #[test] fn highlight_with_an_invalid_colour_is_rejected_and_keeps_the_highlight() { let mut s = session(); From 82573331a8f2b87ccb536b9b66d55b90295f2111 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 31 Oct 2026 18:52:58 -0400 Subject: [PATCH 044/716] packaging(flatpak): add OCI image build and GHCR publishing helper (#1625) --- packaging/linux/flatpak-bundle.sh | 8 ++++ packaging/linux/flatpak-oci.sh | 64 +++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100755 packaging/linux/flatpak-oci.sh diff --git a/packaging/linux/flatpak-bundle.sh b/packaging/linux/flatpak-bundle.sh index 3a5508d7c..e56692adf 100755 --- a/packaging/linux/flatpak-bundle.sh +++ b/packaging/linux/flatpak-bundle.sh @@ -20,10 +20,12 @@ APP_ID=ai.storyteller.deckcraft FLATHUB=https://dl.flathub.org/repo/flathub.flatpakrepo TEST=1 +OCI=0 TARBALL="" while [[ $# -gt 0 ]]; do case "$1" in --no-test) TEST=0; shift ;; + --oci) OCI=1; shift ;; -h | --help) sed -n '2,14p' "$0"; exit 0 ;; -*) echo "unknown argument: $1" >&2; exit 2 ;; *) TARBALL="$1"; shift ;; @@ -61,6 +63,12 @@ OUT="$DIST/$BASENAME.flatpak" # --runtime-repo lets `flatpak install` fetch the freedesktop runtime from Flathub if missing. flatpak build-bundle --runtime-repo="$FLATHUB" "$WORK/repo" "$OUT" "$APP_ID" stable echo "wrote $OUT" +if [[ "$OCI" = 1 ]]; then + OUT_OCI="$DIST/$BASENAME-oci" + rm -rf "$OUT_OCI" + flatpak build-bundle --oci "$WORK/repo" "$OUT_OCI" "$APP_ID" stable + echo "wrote OCI layout to $OUT_OCI" +fi if [[ "$TEST" = 1 ]]; then flatpak install --user -y --noninteractive --reinstall "$OUT" diff --git a/packaging/linux/flatpak-oci.sh b/packaging/linux/flatpak-oci.sh new file mode 100755 index 000000000..5dd360353 --- /dev/null +++ b/packaging/linux/flatpak-oci.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash +# Build deckcraft as an OCI container layout and push it to GitHub Container Registry (GHCR) +# for consumption by Flatpak OCI clients (flatpak-oci-specs). +# +# Usage: +# packaging/linux/flatpak-oci.sh [--push] [TARBALL] +# +# Environment variables: +# REGISTRY Target registry image (default: ghcr.io/storytold/deckcraft) +# TAG Target image tag (default: $VERSION-$ARCH, also tags stable-$ARCH) +# GITHUB_TOKEN Token for GHCR authentication when --push is used +set -euo pipefail +# shellcheck source=../env.sh +. "$(dirname "${BASH_SOURCE[0]}")/../env.sh" +HERE="$ROOT/packaging/linux" + +PUSH=0 +TARBALL="" +while [[ $# -gt 0 ]]; do + case "$1" in + --push) PUSH=1; shift ;; + -h | --help) sed -n '2,12p' "$0"; exit 0 ;; + -*) echo "unknown argument: $1" >&2; exit 2 ;; + *) TARBALL="$1"; shift ;; + esac +done + +ARCH="$(uname -m)" +case "$ARCH" in + x86_64) ;; + aarch64 | arm64) ARCH=aarch64 ;; + *) echo "unsupported architecture $ARCH" >&2; exit 2 ;; +esac + +BASENAME="deckcraft-$VERSION-linux-$ARCH" +OUT_OCI="$DIST/$BASENAME-oci" + +echo "==> Building Flatpak OCI layout for $BASENAME" +"$HERE/flatpak-bundle.sh" --oci --no-test "${TARBALL:-}" + +[[ -d "$OUT_OCI" ]] || { echo "error: $OUT_OCI layout not generated" >&2; exit 1; } + +REGISTRY="${REGISTRY:-ghcr.io/storytold/deckcraft}" +TAG="${TAG:-$VERSION-$ARCH}" + +echo "==> OCI layout ready at $OUT_OCI (Target: $REGISTRY:$TAG)" + +if [[ "$PUSH" = 1 ]]; then + command -v skopeo >/dev/null || { echo "error: skopeo is required to push OCI images (apt install skopeo)" >&2; exit 1; } + + AUTH_ARGS=() + if [[ -n "${GITHUB_TOKEN:-}" ]]; then + AUTH_ARGS=(--dest-creds "${GITHUB_ACTOR:-storytold}:$GITHUB_TOKEN") + fi + + echo "==> Pushing to $REGISTRY:$TAG" + skopeo copy --format oci "${AUTH_ARGS[@]}" "oci:$OUT_OCI" "docker://$REGISTRY:$TAG" + + # Also update architecture-specific stable tag + echo "==> Pushing to $REGISTRY:stable-$ARCH" + skopeo copy --format oci "${AUTH_ARGS[@]}" "oci:$OUT_OCI" "docker://$REGISTRY:stable-$ARCH" + + echo "==> Push complete" +fi From 3fb6c4313657a2f755ab9bc99abd3cfff8a1ec0b Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sun, 1 Nov 2026 00:08:51 +0100 Subject: [PATCH 045/716] =?UTF-8?q?Lowercase=20word-final=20=CE=A3=20as=20?= =?UTF-8?q?=CF=82=20in=20title=20and=20sentence=20case?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Found while testing crates/model/src/edit.rs:470-497 (change_case_parts, title/sentence branch) Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/model/src/edit.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/crates/model/src/edit.rs b/crates/model/src/edit.rs index d635c052e..3e21e3bf8 100644 --- a/crates/model/src/edit.rs +++ b/crates/model/src/edit.rs @@ -469,6 +469,9 @@ pub fn change_case(s: &str, mode: &str) -> String { /// piece is the changed form of the matching input piece, even where a character changes length. pub fn change_case_parts(parts: &[&str], mode: &str) -> Vec { let mut start = true; + // All characters of all pieces, so word-final sigma sees neighbours across piece boundaries. + let all: Vec = parts.iter().flat_map(|s| s.chars()).collect(); + let mut base = 0; parts .iter() .map(|s| match mode { @@ -479,10 +482,14 @@ pub fn change_case_parts(parts: &[&str], mode: &str) -> Vec { // `title` restarts after whitespace, sentence case after sentence punctuation. let title = mode == "title"; let mut out = String::new(); - for c in s.chars() { + for (j, c) in s.chars().enumerate() { + let i = base + j; if start && c.is_alphabetic() { out.extend(c.to_uppercase()); start = false; + } else if c == 'Σ' && i > 0 && all[i - 1].is_alphabetic() && !all.get(i + 1).is_some_and(|n| n.is_alphabetic()) { + // Word-final capital sigma lowercases to ς, as `str::to_lowercase` does. + out.push('ς'); } else { out.extend(c.to_lowercase()); } @@ -490,6 +497,7 @@ pub fn change_case_parts(parts: &[&str], mode: &str) -> Vec { start = true; } } + base += s.chars().count(); out } }) @@ -504,6 +512,20 @@ mod tests { TextBody::from_text(t) } + #[test] + fn title_and_sentence_final_sigma() { + assert_eq!(change_case("ΟΔΟΣ", "title"), "Οδος"); + assert_eq!(change_case("ΟΔΟΣ ΜΟΥ.", "sentence"), "Οδος μου."); + assert_eq!(change_case("ΟΔΟΣ", "lower"), "οδος"); + } + + #[test] + fn title_sigma_across_runs_is_not_final() { + assert_eq!(change_case_parts(&["ΟΔΟΣ", "ΑΣ"], "title"), ["Οδοσ", "ας"]); + assert_eq!(change_case_parts(&["ΟΔΟ", "ΣΑ"], "title"), ["Οδο", "σα"]); + assert_eq!(change_case_parts(&["ΟΔΟΣ", " ΜΟΥ"], "title"), ["Οδος", " Μου"]); + } + #[test] fn insert_and_split() { let mut b = body("Hello"); From 87a10fc8e2af63042e560e530336f1cc6ff8c535 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sun, 1 Nov 2026 00:19:15 +0100 Subject: [PATCH 046/716] Keep combining marks inside spell-check words Found while testing crates/engine/src/spell.rs:693 (paragraph_words, the `inside` closure) Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/engine/src/spell.rs | 12 ++++++++++-- crates/model/src/words.rs | 7 ++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/spell.rs b/crates/engine/src/spell.rs index 93852e3f8..8927ade5b 100644 --- a/crates/engine/src/spell.rs +++ b/crates/engine/src/spell.rs @@ -709,7 +709,8 @@ pub fn paragraph_words(p: &deckcraft_model::Paragraph, default: &str) -> Vec Vec a && !chars[b - 1].0.is_alphanumeric() { + while b > a && !chars[b - 1].0.is_alphanumeric() && !deckcraft_model::words::is_combining_mark(chars[b - 1].0) { b -= 1; } let text: String = chars[a..b].iter().map(|c| c.0).collect(); @@ -819,6 +820,13 @@ SFX D Y 1\nSFX D 0 ed/S .\n"; Dictionary::parse(AFF.as_bytes(), DIC.as_bytes()) } + #[test] + fn nfd_word_not_split() { + let p = deckcraft_model::Paragraph::new("Das na\u{ef}ve Caf\u{e9} und cafe\u{301} na\u{308}ive"); + let w: Vec = paragraph_words(&p, "en-US").into_iter().map(|w| w.text).collect(); + assert_eq!(w, ["Das", "na\u{ef}ve", "Caf\u{e9}", "und", "cafe\u{301}", "na\u{308}ive"]); + } + #[test] fn curly_apostrophe_matches_ascii_entry() { let d = Dictionary::parse(AFF.as_bytes(), "2\ndon't\nwork\n".as_bytes()); diff --git a/crates/model/src/words.rs b/crates/model/src/words.rs index 54b23659f..bcf662e22 100644 --- a/crates/model/src/words.rs +++ b/crates/model/src/words.rs @@ -90,11 +90,16 @@ fn base_class(c: char) -> Class { c if c.is_alphanumeric() => Class::Word, c if is_symbol(c) => Class::Symbol, // A combining mark with no base (or any other mark) stays with letters. - '\u{300}'..='\u{36f}' | '\u{1ab0}'..='\u{1aff}' | '\u{1dc0}'..='\u{1dff}' | '\u{20d0}'..='\u{20ff}' | '\u{fe20}'..='\u{fe2f}' => Class::Word, + c if is_combining_mark(c) => Class::Word, _ => Class::Punct, } } +/// Whether `c` is a combining mark (a decomposed accent), which belongs to the letter before it. +pub fn is_combining_mark(c: char) -> bool { + matches!(c, '\u{300}'..='\u{36f}' | '\u{1ab0}'..='\u{1aff}' | '\u{1dc0}'..='\u{1dff}' | '\u{20d0}'..='\u{20ff}' | '\u{fe20}'..='\u{fe2f}') +} + fn clusters(text: &str) -> Vec { let mut out: Vec = Vec::new(); let mut firsts: Vec = Vec::new(); From 8ec4f29059de67706a72e1066b06cc592828aa80 Mon Sep 17 00:00:00 2001 From: Madhasoeki Date: Sun, 1 Nov 2026 07:19:41 +0700 Subject: [PATCH 047/716] Fonts: refine monospace heuristic and preserve office_twin order (#1598) - Avoid false-positive monospace match on 'code' in split_whitespace for proportional families like Code Pro. - Check office_twin before is_monospace_family in document_face so alias families like Courier New CE resolve to Courier New when installed. - Add negative tests for Code Pro and test Courier New CE mapping. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- crates/fonts/src/fontdb.rs | 12 +++++------- crates/fonts/src/tests.rs | 12 ++++++++---- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/crates/fonts/src/fontdb.rs b/crates/fonts/src/fontdb.rs index cc2bd417a..1cffbe008 100644 --- a/crates/fonts/src/fontdb.rs +++ b/crates/fonts/src/fontdb.rs @@ -105,7 +105,7 @@ pub fn is_monospace_family(family: &str) -> bool { || s.ends_with(" console") || s.ends_with(" typewriter") || s.ends_with(" monospace") - || s.split_whitespace().any(|w| w == "mono" || w == "code" || w == "terminal" || w == "monospace") + || s.split_whitespace().any(|w| w == "mono" || w == "terminal" || w == "monospace") } /// Families whose open substitutes ([`substitutes`]) keep their metrics, so text drawn with @@ -1149,17 +1149,15 @@ impl FontDb { /// Monospaced families keep a monospaced substitute instead of falling back to Calibri. /// DeckCraft's own default family keeps [`FontDb::face`]'s fallbacks. pub fn document_face(&self, family: &str, style: &str) -> Arc { - if family.eq_ignore_ascii_case(FALLBACK_FAMILY) - || has_metric_twin(family) - || is_monospace_family(family) - || is_office_cloud_font(family) - || self.has_family(family) - { + if family.eq_ignore_ascii_case(FALLBACK_FAMILY) || has_metric_twin(family) || is_office_cloud_font(family) || self.has_family(family) { return self.face(family, style); } if let Some(twin) = office_twin(family) { return self.face(twin, style); } + if is_monospace_family(family) { + return self.face(family, style); + } self.face(MISSING_FONT_FAMILY, style) } diff --git a/crates/fonts/src/tests.rs b/crates/fonts/src/tests.rs index 69f54227d..f912f9988 100644 --- a/crates/fonts/src/tests.rs +++ b/crates/fonts/src/tests.rs @@ -216,9 +216,13 @@ fn missing_document_fonts_are_drawn_in_calibri() { assert_eq!(f.family, db.face(MISSING_FONT_FAMILY, "Bold").family, "{missing:?}"); } // PowerPoint's own twins and Windows' substitutes, when the font itself is missing. - for (missing, twin) in - [("Liberation Sans", "Arial"), ("Liberation Serif", "Times New Roman"), ("Arial CE", "Arial"), ("Times New Roman CYR", "Times New Roman")] - { + for (missing, twin) in [ + ("Liberation Sans", "Arial"), + ("Liberation Serif", "Times New Roman"), + ("Arial CE", "Arial"), + ("Times New Roman CYR", "Times New Roman"), + ("Courier New CE", "Courier New"), + ] { if !db.has_family(missing) { assert_eq!(db.document_face(missing, "Regular").family, db.face(twin, "Regular").family, "{missing}"); } @@ -261,7 +265,7 @@ fn office_fonts_have_substitutes() { assert!(is_monospace_family(mono), "{mono} should be recognized as monospace"); } - for prop in ["Calibri", "Arial", "Times New Roman", "Inter", "Monotype Corsiva", "Monotype Baskerville", "zzz"] { + for prop in ["Calibri", "Arial", "Times New Roman", "Inter", "Monotype Corsiva", "Monotype Baskerville", "Code Pro", "zzz"] { assert!(!is_monospace_family(prop), "{prop} should not be recognized as monospace"); } } From 773133ec42c01ea7f418e5bdb1048453dd427c50 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sun, 1 Nov 2026 00:52:04 +0000 Subject: [PATCH 048/716] Apply alphaMod and alphaOff in ColorRef::alpha Found while testing crates/model/src/style.rs:59-63 Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/model/src/style.rs | 4 +++- crates/model/src/tests.rs | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/crates/model/src/style.rs b/crates/model/src/style.rs index e2d70b994..3b81d3ae5 100644 --- a/crates/model/src/style.rs +++ b/crates/model/src/style.rs @@ -55,10 +55,12 @@ impl ColorRef { }; deckcraft_color::apply(base, &self.mods) } - /// Alpha (0–1) from an `alpha` transform, if any. + /// Alpha (0–1) from the `alpha`, `alphaMod` and `alphaOff` transforms, applied in order. pub fn alpha(&self) -> f64 { self.mods.iter().fold(1.0, |a, m| match m { ColorTransform::Alpha(v) => (*v as f64 / 100_000.0).clamp(0.0, 1.0), + ColorTransform::AlphaMod(v) => (a * *v as f64 / 100_000.0).clamp(0.0, 1.0), + ColorTransform::AlphaOff(v) => (a + *v as f64 / 100_000.0).clamp(0.0, 1.0), _ => a, }) } diff --git a/crates/model/src/tests.rs b/crates/model/src/tests.rs index 1fd29aeff..4ae6fc0fd 100644 --- a/crates/model/src/tests.rs +++ b/crates/model/src/tests.rs @@ -327,3 +327,15 @@ fn only_web_and_mail_links_are_safe_to_open() { assert!(!safe_url(url), "{url}"); } } + +#[test] +fn colour_alpha_follows_alpha_mod_and_off() { + use deckcraft_color::{ColorTransform, Rgba}; + let base = || ColorRef::rgb(Rgba::rgb(1, 2, 3)); + let mod_half = base().with(ColorTransform::AlphaMod(50000)); + assert!((mod_half.alpha() - 0.5).abs() < 1e-9, "{}", mod_half.alpha()); + let off = base().with(ColorTransform::AlphaOff(-50000)); + assert!((off.alpha() - 0.5).abs() < 1e-9, "{}", off.alpha()); + let both = base().with(ColorTransform::Alpha(40000)).with(ColorTransform::AlphaMod(50000)); + assert!((both.alpha() - 0.2).abs() < 1e-9, "{}", both.alpha()); +} From 5d27461fa633f261a6af037bac9b8ce0953a25ba Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sun, 1 Nov 2026 02:55:58 +0100 Subject: [PATCH 049/716] Keep Xfrm::rot_norm within 0..360 for tiny negative rotations Found while testing crates/geom/src/lib.rs:155-158 Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/geom/src/lib.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/geom/src/lib.rs b/crates/geom/src/lib.rs index 3be72e03f..6f695375b 100644 --- a/crates/geom/src/lib.rs +++ b/crates/geom/src/lib.rs @@ -153,8 +153,8 @@ impl Xfrm { } /// Rotation normalised to 0..360. pub fn rot_norm(&self) -> f64 { - let r = self.rot % 360.0; - if r < 0.0 { r + 360.0 } else { r } + let r = self.rot.rem_euclid(360.0); + if r >= 360.0 { 0.0 } else { r } } } @@ -266,6 +266,14 @@ mod tests { assert!((p.x - 300.0).abs() < 1e-9 && (p.y - 200.0).abs() < 1e-9); } + #[test] + fn rot_norm_stays_below_360() { + for rot in [-1e-15, -1e-13, -f64::EPSILON, -0.0, 360.0, 720.0, -360.0] { + let n = Xfrm { rot, ..Default::default() }.rot_norm(); + assert!((0.0..360.0).contains(&n), "rot {rot} -> {n}"); + } + } + #[test] fn segment_distance() { assert!((dist_to_segment(Point::new(5.0, 5.0), Point::new(0.0, 0.0), Point::new(10.0, 0.0)) - 5.0).abs() < 1e-9); From c0468b59cd043286ca7453c0465da898a4f36751 Mon Sep 17 00:00:00 2001 From: Madhasoeki Date: Sun, 1 Nov 2026 10:31:17 +0700 Subject: [PATCH 050/716] Fonts: classify Cascadia Code PL as monospace (#1598) Add Cascadia Code PL and Cascadia Mono PL to the monospace family matching list, and add regression tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- crates/fonts/src/fontdb.rs | 2 ++ crates/fonts/src/tests.rs | 1 + 2 files changed, 3 insertions(+) diff --git a/crates/fonts/src/fontdb.rs b/crates/fonts/src/fontdb.rs index 1cffbe008..2e2f35299 100644 --- a/crates/fonts/src/fontdb.rs +++ b/crates/fonts/src/fontdb.rs @@ -72,7 +72,9 @@ pub fn is_monospace_family(family: &str) -> bool { | "source code pro" | "jetbrains mono" | "cascadia code" + | "cascadia code pl" | "cascadia mono" + | "cascadia mono pl" | "fira code" | "fira mono" | "inconsolata" diff --git a/crates/fonts/src/tests.rs b/crates/fonts/src/tests.rs index f912f9988..dc52cfbbb 100644 --- a/crates/fonts/src/tests.rs +++ b/crates/fonts/src/tests.rs @@ -251,6 +251,7 @@ fn office_fonts_have_substitutes() { "Source Code Pro", "JetBrains Mono", "Cascadia Code", + "Cascadia Code PL", "Cascadia Mono", "Fira Code", "Inconsolata", From e6908295439bdb5dad0b334f104c3a52f04a6d94 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 31 Oct 2026 23:43:08 -0400 Subject: [PATCH 051/716] ci: grant packages write permission to release workflow --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9d061bce5..09b477f38 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,6 +12,7 @@ on: permissions: contents: write + packages: write concurrency: group: release-${{ github.ref }} From f3d8ba85a62c72bb526dad3b91852485b1ab4f09 Mon Sep 17 00:00:00 2001 From: Madhasoeki Date: Sun, 1 Nov 2026 11:35:53 +0700 Subject: [PATCH 052/716] tests(fonts): add specific tests requested by reviewer for monospace resolution Verify Consolas, Courier New, Fira Code, Monotype Corsiva, Monoton, and ensure proportional family substitutes remain unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- crates/fonts/src/tests.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/fonts/src/tests.rs b/crates/fonts/src/tests.rs index dc52cfbbb..596415d51 100644 --- a/crates/fonts/src/tests.rs +++ b/crates/fonts/src/tests.rs @@ -266,9 +266,24 @@ fn office_fonts_have_substitutes() { assert!(is_monospace_family(mono), "{mono} should be recognized as monospace"); } - for prop in ["Calibri", "Arial", "Times New Roman", "Inter", "Monotype Corsiva", "Monotype Baskerville", "Code Pro", "zzz"] { + for prop in ["Calibri", "Arial", "Times New Roman", "Inter", "Monotype Corsiva", "Monoton", "Monotype Baskerville", "Code Pro", "zzz"] { assert!(!is_monospace_family(prop), "{prop} should not be recognized as monospace"); } + + // Explicit checks requested in review: Consolas, Courier New, Fira Code, Monotype Corsiva, Monoton, + // and ensuring proportional families maintain their unchanged substitutes. + assert!(is_monospace_family("Consolas")); + assert!(is_monospace_family("Courier New")); + assert!(is_monospace_family("Fira Code")); + assert!(!is_monospace_family("Monotype Corsiva")); + assert!(!is_monospace_family("Monoton")); + + assert_eq!(substitutes("Calibri"), &["Carlito", "Liberation Sans", "Arial", "Inter"]); + assert_eq!(substitutes("Arial"), &["Liberation Sans", "Arial", "Helvetica Neue", "Helvetica", "Inter"]); + assert_eq!(substitutes("Times New Roman"), &["Liberation Serif", "Times New Roman", "Times", "Merriweather"]); + assert_eq!(substitutes("Georgia"), &["Merriweather", "Liberation Serif", "Georgia"]); + assert!(substitutes("Monotype Corsiva").is_empty()); + assert!(substitutes("Monoton").is_empty()); } #[test] From 0d190bc0af375d12b22f14c522f34a7ecb9e87e6 Mon Sep 17 00:00:00 2001 From: MarekSpodBiedry <73122968+MarekSpodBiedry@users.noreply.github.com> Date: Sun, 1 Nov 2026 07:38:17 +0100 Subject: [PATCH 053/716] Keep pasting into the notes while they are being edited (#1550) --- crates/engine/src/cmd/edit.rs | 6 +++--- crates/engine/src/tests.rs | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index 6d39cc050..9a25b008d 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -277,9 +277,9 @@ fn paste(s: &mut Session, p: &Value) -> Result { } return paste_plain(s, t); } - let editing = s.doc()?.selection.text.is_some(); - // Copied shapes are pasted as shapes even while a text box is being edited (the caret leaves it). - if editing && (s.clipboard.text.is_some() || s.clipboard.shapes.is_empty()) { + let (editing, notes) = s.doc()?.selection.text.as_ref().map_or((false, false), |t| (true, t.notes)); + // Copied shapes are pasted as shapes even while a text box is being edited (the caret leaves it), but never into the notes. + if editing && (notes || s.clipboard.text.is_some() || s.clipboard.shapes.is_empty()) { if let Some(body) = s.clipboard.text.clone() { return super::text::paste_body(s, &body); } diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 2a75b08fd..4c79476d2 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -228,6 +228,18 @@ fn copied_shapes_paste_as_shapes_while_a_text_box_is_being_edited() { assert!(s.doc().unwrap().selection.text.is_none()); } +#[test] +fn copied_shapes_are_not_pasted_while_the_notes_are_being_edited() { + let mut s = session(); + s.execute("shape.insert", &json!({"preset": "ellipse", "rect": [10, 10, 50, 50]})).unwrap(); + s.execute("edit.copy", &json!({})).unwrap(); + s.execute("text.edit", &json!({"notes": true})).unwrap(); + let before = s.doc().unwrap().current_slide().unwrap().shapes.len(); + s.execute("edit.paste", &json!({})).unwrap(); + assert_eq!(s.doc().unwrap().current_slide().unwrap().shapes.len(), before); + assert!(s.doc().unwrap().selection.text.as_ref().is_some_and(|t| t.notes)); +} + #[test] fn pasted_shapes_get_the_next_automatic_name() { let mut s = session(); From c37b1509502cfcbc70c678adcde6f6c4cdab9ec5 Mon Sep 17 00:00:00 2001 From: Naseq Date: Sun, 1 Nov 2026 11:17:08 +0430 Subject: [PATCH 054/716] PPTX: parse each tags part once, cap copied tags, and bound cache (#1164) - Parse each tags part once per import and cache in `Imp::tags_by_part` - Cap total copied tags into the model at `MAX_TAG_BYTES` (64 MiB), charging each pair a fixed size_of::<(String, String)>() in addition to text - Bound the cache: once `tags_capped` is set, return early before parsing or caching any subsequent part - Tests covering deduplicated part copies, empty-tag pair budgets, and verifying unread tag parts are not parsed or cached after the budget is reached --- crates/pptx/src/lib.rs | 1 + crates/pptx/src/read.rs | 72 +++++++++++++++++++++-- crates/pptx/tests/it/tags.rs | 108 +++++++++++++++++++++++++++++++++++ 3 files changed, 175 insertions(+), 6 deletions(-) diff --git a/crates/pptx/src/lib.rs b/crates/pptx/src/lib.rs index 1b1dc5b46..be08c680f 100644 --- a/crates/pptx/src/lib.rs +++ b/crates/pptx/src/lib.rs @@ -14,6 +14,7 @@ mod maps; mod opc; mod png; pub(crate) mod read; +pub use read::MAX_TAG_BYTES; mod tables; mod write; mod xml; diff --git a/crates/pptx/src/read.rs b/crates/pptx/src/read.rs index 917aa9277..288e497f8 100644 --- a/crates/pptx/src/read.rs +++ b/crates/pptx/src/read.rs @@ -40,6 +40,12 @@ pub struct Imp<'a> { pub kept_sidecar_bytes: usize, /// Cached kept sidecars by normalized chart part name. pub kept_charts: HashMap, + /// Add-in tags parts, parsed once each, by normalized part name. + pub tags_by_part: HashMap>, + /// Bytes of tags copied into the model so far (see [`MAX_TAG_BYTES`]). + pub tag_bytes: usize, + /// The tag budget ran out and the warning was given. + pub tags_capped: bool, } impl Imp<'_> { @@ -196,16 +202,64 @@ fn choice_has_model3d(el: &El, rels: &Rels) -> bool { rec(el, rels, 0) } +/// Bytes of tags one import copies into the model, every tags part and reference together: a +/// small compressed tags part listed by many shapes, or many times by one, must not grow without +/// bound (#1164). The package budgets (`opc::MAX_XML_PART`, `MAX_TOTAL`, #1283) bound what is +/// parsed; this bounds what is copied from it. +pub const MAX_TAG_BYTES: usize = 64 << 20; +/// What each copied pair costs besides its text, so empty pairs count too. +const TAG_PAIR_COST: usize = std::mem::size_of::<(String, String)>(); + /// Add-in tags named by `holder`'s `p:custDataLst`: the name/value pairs of each tags part. -pub fn tags(imp: &Imp, part: &Part, holder: &El) -> Vec<(String, String)> { +/// Each part is parsed once per import and counted once per holder. Once [`MAX_TAG_BYTES`] is +/// reached, no further tag parts are parsed or cached (#1164). +pub fn tags(imp: &mut Imp, part: &Part, holder: &El) -> Vec<(String, String)> { + if imp.tags_capped { + return vec![]; + } let Some(list) = holder.child("custDataLst") else { return vec![] }; let mut out = Vec::new(); + let mut seen = HashSet::new(); for t in list.children_named("tags").take(100) { - let Some(doc) = t.attr("r:id").and_then(|id| part.rels.get(id)).and_then(|r| imp.pkg.xml(&r.target)) else { continue }; - for tag in doc.root.children_named("tag").take(10_000) { - if let Some(name) = tag.attr("name") { - out.push((name.to_string(), tag.attr("val").unwrap_or("").to_string())); + if imp.tags_capped { + return out; + } + let Some(target) = t.attr("r:id").and_then(|id| part.rels.get(id)).map(|r| opc::norm(&r.target)) else { continue }; + if !seen.insert(target.clone()) { + continue; + } + let parsed = match imp.tags_by_part.get(&target) { + Some(p) => p.clone(), + None => { + if imp.tags_capped { + return out; + } + let p: Arc<[(String, String)]> = imp + .pkg + .xml(&target) + .map(|doc| { + doc.root + .children_named("tag") + .take(10_000) + .filter_map(|tag| Some((tag.attr("name")?.to_string(), tag.attr("val").unwrap_or("").to_string()))) + .collect() + }) + .unwrap_or_default(); + imp.tags_by_part.insert(target, p.clone()); + p } + }; + for (name, val) in parsed.iter() { + let n = imp.tag_bytes.saturating_add(TAG_PAIR_COST + name.len() + val.len()); + if n > MAX_TAG_BYTES { + if !imp.tags_capped { + log::warn!("pptx: add-in tags over {MAX_TAG_BYTES} bytes; the rest are dropped"); + imp.tags_capped = true; + } + return out; + } + imp.tag_bytes = n; + out.push((name.clone(), val.clone())); } } out @@ -389,6 +443,9 @@ pub fn import_theme(bytes: &[u8]) -> Result<(deckcraft_model::theme::Theme, Vec< vml_previews: HashMap::new(), kept_sidecar_bytes: 0, kept_charts: HashMap::new(), + tags_by_part: HashMap::new(), + tag_bytes: 0, + tags_capped: false, }; let part = Part::new(&pkg, &theme_path, &doc); let theme = theme::read_theme(&mut imp, &part, &doc.root); @@ -427,6 +484,9 @@ pub fn import_checked(bytes: &[u8]) -> Result<(Presentation, Vec), PptxE vml_previews: HashMap::new(), kept_sidecar_bytes: 0, kept_charts: HashMap::new(), + tags_by_part: HashMap::new(), + tag_bytes: 0, + tags_capped: false, }; // Slide ids first so hyperlinks anywhere can point at slides. let slide_ids = register_slides(&mut imp, &docs, &slide_entries, &mut lost_slides); @@ -441,7 +501,7 @@ pub fn import_checked(bytes: &[u8]) -> Result<(Presentation, Vec), PptxE let layout_by_part = read_masters(&mut imp, &mut p, &master_paths, &docs); let file_slide_ids = read_slides(&mut imp, &mut p, &pres_part, &docs, &slide_ids, &layout_by_part); read_sections(&mut p, &pres_part, pres_el, &file_slide_ids); - p.tags = tags(&imp, &pres_part, pres_el); + p.tags = tags(&mut imp, &pres_part, pres_el); read_custom_shows(&mut p, &imp, &pres_part, pres_el); read_guides_and_show(&mut p, &imp, &pres_part); read_notes_master(&mut imp, &mut p, &pres_part); diff --git a/crates/pptx/tests/it/tags.rs b/crates/pptx/tests/it/tags.rs index e8903b442..8cc0849be 100644 --- a/crates/pptx/tests/it/tags.rs +++ b/crates/pptx/tests/it/tags.rs @@ -36,3 +36,111 @@ fn tags_survive_round_trip() { assert_eq!(first.tags, vec![t("THINKCELLSHAPEDONOTDELETE", "t!abc")]); assert!(back.slides.iter().skip(1).all(|s| s.tags.is_empty())); } + +/// #1164: the same tags part listed over and over is read once, and the tags one import copies +/// into the model are capped however often a shape lists them. +#[test] +fn a_tags_part_listed_many_times_is_copied_once_and_capped() { + let mut s = Session::new(); + deckcraft_engine::sample::open_sample(&mut s).expect("sample"); + for _ in 0..6 { + s.execute("shape.insert", &serde_json::json!({"preset": "rect", "rect": [10, 10, 50, 50]})).expect("shape"); + } + let mut p = s.doc().expect("doc").doc.as_ref().clone(); + let slide = Arc::make_mut(&mut p.slides[0]); + // A quarter of the budget with its name and pair cost: the fifth shape listing it goes over. + let pair = std::mem::size_of::<(String, String)>(); + slide.shapes[0].tags = vec![t("BIG", &"x".repeat(deckcraft_pptx::MAX_TAG_BYTES / 4 - 3 - pair))]; + let bytes = deckcraft_pptx::export(&p).expect("export"); + + // Every shape on the first slide lists that one tags part 100 times. + let mut zip = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip"); + let mut xml = String::new(); + zip.by_name("ppt/slides/slide1.xml").expect("slide").read_to_string(&mut xml).expect("read"); + let start = xml.find("").expect("tags listed"); + let end = xml[start..].find("").expect("list ends") + start + "".len(); + let list = &xml[start..end]; + let inner = list.trim_start_matches("").trim_end_matches(""); + let many = format!("{}", inner.repeat(100)); + let xml = xml.replace(list, "").replace("", "").replace("", &format!("{many}")); + assert!(xml.matches(&many).count() >= 5, "enough shapes to go over the budget"); + let mut out = zip::ZipWriter::new(Cursor::new(Vec::new())); + for i in 0..zip.len() { + let mut f = zip.by_index(i).expect("entry"); + let name = f.name().to_string(); + let mut data = vec![]; + f.read_to_end(&mut data).expect("read"); + out.start_file(&name, zip::write::SimpleFileOptions::default()).expect("start"); + std::io::Write::write_all(&mut out, if name == "ppt/slides/slide1.xml" { xml.as_bytes() } else { &data }).expect("write"); + } + let bytes = out.finish().expect("finish").into_inner(); + + let back = deckcraft_pptx::import(&bytes).expect("import"); + let tagged: Vec<_> = back.slides[0].shapes.iter().filter(|x| !x.tags.is_empty()).collect(); + assert_eq!(tagged.len(), 4, "four copies fit the budget"); + assert!(tagged.iter().all(|x| x.tags.len() == 1), "each shape keeps the part's tag once, not 100 times"); +} + +/// #1164: empty tags cost something too, or a part of 10,000 empty pairs listed by every shape +/// would be copied without ever reaching the budget. +#[test] +fn empty_tags_count_against_the_budget() { + let pair = std::mem::size_of::<(String, String)>(); + let per_shape = 10_000 * pair; + let shapes = deckcraft_pptx::MAX_TAG_BYTES / per_shape + 2; + let mut s = Session::new(); + deckcraft_engine::sample::open_sample(&mut s).expect("sample"); + let mut p = s.doc().expect("doc").doc.as_ref().clone(); + let slide = Arc::make_mut(&mut p.slides[0]); + let template = slide.shapes[0].clone(); + slide.shapes.clear(); + for i in 0..shapes { + let mut sh = template.clone(); + sh.id = deckcraft_model::ShapeId(10_000 + i as u32); + sh.ph = None; + sh.tags = vec![t("", ""); 10_000]; + slide.shapes.push(sh); + } + let bytes = deckcraft_pptx::export(&p).expect("export"); + let back = deckcraft_pptx::import(&bytes).expect("import"); + let pairs: usize = back.slides[0].shapes.iter().map(|x| x.tags.len()).sum(); + assert!(pairs * pair <= deckcraft_pptx::MAX_TAG_BYTES, "{pairs} pairs copied"); + assert!(pairs < shapes * 10_000, "the budget stopped the copying"); +} + +/// #1164: once the budget is exhausted, further tags parts are not parsed or cached into +/// `tags_by_part`. +#[test] +fn new_tag_parts_are_not_parsed_or_cached_after_the_budget_is_exhausted() { + let mut s = Session::new(); + deckcraft_engine::sample::open_sample(&mut s).expect("sample"); + s.execute("shape.insert", &serde_json::json!({"preset": "rect", "rect": [10, 10, 50, 50]})).expect("shape"); + let mut p = s.doc().expect("doc").doc.as_ref().clone(); + let slide = Arc::make_mut(&mut p.slides[0]); + assert!(slide.shapes.len() >= 2); + // The first shape's tag fits the budget, and a second pair pushes it over the cap. + let pair = std::mem::size_of::<(String, String)>(); + slide.shapes[0].tags = vec![t("BIG", &"x".repeat(deckcraft_pptx::MAX_TAG_BYTES - 3 - pair)), t("OVER", "1")]; + // The second shape has its own separate tag part. + slide.shapes[1].tags = vec![t("SHAPE2_TAG", "dropped")]; + let bytes = deckcraft_pptx::export(&p).expect("export"); + + // Corrupt the second shape's tag part (`tag2.xml`) with invalid XML in the zip. + // If it were parsed, XML loading would fail. Because the budget was capped, it is never read. + let mut zip = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip"); + let mut out = zip::ZipWriter::new(Cursor::new(Vec::new())); + for i in 0..zip.len() { + let mut f = zip.by_index(i).expect("entry"); + let name = f.name().to_string(); + let mut data = vec![]; + f.read_to_end(&mut data).expect("read"); + out.start_file(&name, zip::write::SimpleFileOptions::default()).expect("start"); + let payload = if name == "ppt/tags/tag2.xml" { b" Date: Sun, 1 Nov 2026 11:54:38 +0430 Subject: [PATCH 055/716] Text: scale down insets when wider than the shape (#1632) When text insets exceed the shape dimensions (e.g. lIns + rIns > width), proportionally scale them down so the inner text rectangle remains bounded within the shape. Prevents off-slide helper shapes with large insets from having their text center shifted onto the slide canvas. --- crates/text/src/layout.rs | 24 ++++++++++++++++++------ crates/text/src/tests.rs | 21 +++++++++++++++++++++ 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/crates/text/src/layout.rs b/crates/text/src/layout.rs index 05cc4beb2..94a0b5f27 100644 --- a/crates/text/src/layout.rs +++ b/crates/text/src/layout.rs @@ -93,12 +93,24 @@ impl BoxGeom { } else { text_rect }; - let inner = Rect::new( - r.x0 + bp.inset_l.unwrap_or(7.2), - r.y0 + bp.inset_t.unwrap_or(3.6), - (r.x1 - bp.inset_r.unwrap_or(7.2)).max(r.x0 + bp.inset_l.unwrap_or(7.2)), - (r.y1 - bp.inset_b.unwrap_or(3.6)).max(r.y0 + bp.inset_t.unwrap_or(3.6)), - ); + // Insets wider than the shape scale down proportionally to fit inside it (#1632). + let (mut ins_l, mut ins_r) = (bp.inset_l.unwrap_or(7.2).max(0.0), bp.inset_r.unwrap_or(7.2).max(0.0)); + let (mut ins_t, mut ins_b) = (bp.inset_t.unwrap_or(3.6).max(0.0), bp.inset_b.unwrap_or(3.6).max(0.0)); + let w = r.width().max(0.0); + let total_x = ins_l + ins_r; + if total_x > w && total_x > 0.0 { + let s = w / total_x; + ins_l *= s; + ins_r *= s; + } + let h = r.height().max(0.0); + let total_y = ins_t + ins_b; + if total_y > h && total_y > 0.0 { + let s = h / total_y; + ins_t *= s; + ins_b *= s; + } + let inner = Rect::new(r.x0 + ins_l, r.y0 + ins_t, (r.x1 - ins_r).max(r.x0 + ins_l), (r.y1 - ins_b).max(r.y0 + ins_t)); // Text that follows a WordArt arch or circle is set on one line per paragraph. let follow = bp.warp.as_deref().is_some_and(deckcraft_geom::warp::is_follow); let wrap = bp.wrap.unwrap_or(true) && !follow && !matches!(bp.autofit, Some(AutoFit::Shape) if shape.text_box && !bp.wrap.unwrap_or(true)); diff --git a/crates/text/src/tests.rs b/crates/text/src/tests.rs index f9f3f3101..a5d3b3248 100644 --- a/crates/text/src/tests.rs +++ b/crates/text/src/tests.rs @@ -1928,3 +1928,24 @@ fn a_paragraph_with_its_own_start_at_restarts_the_count_there() { // A later paragraph with a new start begins a fresh run. check(&[1, 1, 7, 7], &[1, 2, 7, 8]); } + +/// #1632: when insets are wider than the shape, they scale down proportionally so the text +/// rectangle stays inside the shape bounds and unwrapped text does not project outside it. +#[test] +fn insets_wider_than_the_shape_scale_down_within_the_shape_bounds() { + let (p, mut sh) = setup("Collaboration Hub", 14.17, 14.17); + sh.ph = None; + let bp = &mut sh.text.as_mut().unwrap().body; + bp.wrap = Some(false); + bp.inset_l = Some(127.5); + bp.inset_r = Some(11.33); + bp.inset_t = Some(11.33); + bp.inset_b = Some(11.33); + sh.text.as_mut().unwrap().paragraphs[0].props = deckcraft_model::text::ParaProps { align: Some(Align::Center), ..Default::default() }; + let l = lay(&p, &sh, 14.17, 14.17); + assert_eq!(l.lines.len(), 1); + let line = &l.lines[0]; + let mid = (line.caret_x[0] + *line.caret_x.last().unwrap()) / 2.0; + // The text center must remain inside the 14.17 pt wide shape, not pushed ~127.5 pt to the right. + assert!((0.0..=14.17).contains(&mid), "line center {mid} should be within [0, 14.17]"); +} From b5033b6213edfd91fd3558ff757d1320981bc2b2 Mon Sep 17 00:00:00 2001 From: Naseq Date: Sun, 1 Nov 2026 13:38:14 +0430 Subject: [PATCH 056/716] Text: preserve signed insets and scale only when both are non-negative Address review finding: keep signed insets unchanged when their sum fits, scaling opposing insets proportionally only when both in the pair are non-negative and their sum exceeds the box dimension. --- crates/text/src/layout.rs | 8 ++++---- crates/text/src/tests.rs | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/crates/text/src/layout.rs b/crates/text/src/layout.rs index 94a0b5f27..c0422815e 100644 --- a/crates/text/src/layout.rs +++ b/crates/text/src/layout.rs @@ -94,18 +94,18 @@ impl BoxGeom { text_rect }; // Insets wider than the shape scale down proportionally to fit inside it (#1632). - let (mut ins_l, mut ins_r) = (bp.inset_l.unwrap_or(7.2).max(0.0), bp.inset_r.unwrap_or(7.2).max(0.0)); - let (mut ins_t, mut ins_b) = (bp.inset_t.unwrap_or(3.6).max(0.0), bp.inset_b.unwrap_or(3.6).max(0.0)); + let (mut ins_l, mut ins_r) = (bp.inset_l.unwrap_or(7.2), bp.inset_r.unwrap_or(7.2)); + let (mut ins_t, mut ins_b) = (bp.inset_t.unwrap_or(3.6), bp.inset_b.unwrap_or(3.6)); let w = r.width().max(0.0); let total_x = ins_l + ins_r; - if total_x > w && total_x > 0.0 { + if ins_l >= 0.0 && ins_r >= 0.0 && total_x > w && total_x > 0.0 { let s = w / total_x; ins_l *= s; ins_r *= s; } let h = r.height().max(0.0); let total_y = ins_t + ins_b; - if total_y > h && total_y > 0.0 { + if ins_t >= 0.0 && ins_b >= 0.0 && total_y > h && total_y > 0.0 { let s = h / total_y; ins_t *= s; ins_b *= s; diff --git a/crates/text/src/tests.rs b/crates/text/src/tests.rs index a5d3b3248..cb1be0e2e 100644 --- a/crates/text/src/tests.rs +++ b/crates/text/src/tests.rs @@ -1949,3 +1949,18 @@ fn insets_wider_than_the_shape_scale_down_within_the_shape_bounds() { // The text center must remain inside the 14.17 pt wide shape, not pushed ~127.5 pt to the right. assert!((0.0..=14.17).contains(&mid), "line center {mid} should be within [0, 14.17]"); } + +/// #1632: signed insets (e.g. negative left inset with positive right inset) are preserved when +/// their sum fits within the shape bounds. +#[test] +fn signed_insets_are_preserved_when_they_fit() { + let (p, mut sh) = setup("Text", 100.0, 50.0); + sh.ph = None; + let bp = &mut sh.text.as_mut().unwrap().body; + bp.inset_l = Some(-10.0); + bp.inset_r = Some(10.0); + sh.text.as_mut().unwrap().paragraphs[0].props = deckcraft_model::text::ParaProps { align: Some(Align::Left), ..Default::default() }; + let l = lay(&p, &sh, 100.0, 50.0); + assert_eq!(l.lines.len(), 1); + assert_eq!(l.inner.x0, -10.0); +} From 7f742c9d4f4b00f60a16490d1ebc1f3e409fc60f Mon Sep 17 00:00:00 2001 From: Elliot Graham Date: Sun, 1 Nov 2026 09:29:42 +0000 Subject: [PATCH 057/716] FIX-1621: cover locked and outline-free No Fill shapes --- ROADMAP.md | 4 ++- crates/engine/src/tests.rs | 52 +++++++++++++++++++++++++++++++++- crates/engine/src/tools/hit.rs | 1 + docs/gaps.md | 3 +- docs/parity-checklist.md | 3 +- docs/ui-parity.md | 5 ++-- 6 files changed, 62 insertions(+), 6 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 8dc52dfb7..f5e084d3c 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,7 +2,7 @@ **Stage: alpha** · next: beta, ~20 points and ~120–210 h away -> **Last reviewed:** 2026-10-31 · **Last updated:** 2026-10-31 · **Change:** trivial (No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) +> **Last reviewed:** 2026-11-01 · **Last updated:** 2026-11-01 · **Change:** trivial (locked No Fill and no-outline click-through regression coverage added; No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-30 · **Change:** trivial (progress log: read-only `slide.actions` lists shape and table text actions; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-27 · **Change:** trivial (progress log: Set Up Slide Show ▸ Keep mouse cursor visible, #1445; stage and scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-26 · **Change:** trivial (progress log: dragging several selected slides moves them all; previous: trivial, progress log: Edit Points handle drags with Shift, Ctrl/Cmd or Alt/Option set the point type; previous: trivial, progress log: scroll bars on the zoomed slide pane, #1157; previous: minor, native chart payloads stored in bounded ZIP members; previous: major, community PR wave 2026-10-14: ~60 landed items in the progress log, among them the Font, Paragraph, Photo Album, theme colour and font and Date and Time dialogs, presenter and show controls, the SmartArt Text Pane and PPTX corpus slices; breadth 84% after `cargo xtask parity`, ready stays ~55%, stage stays alpha; duplicated rows and headers folded; previous: minor, hours to ~95% per audience added) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) @@ -148,6 +148,7 @@ app's JSON control channel (`deckcraft --control PORT`). | Date | What landed | |---|---| +| 2026-11-01 | No Fill regression coverage now includes locked shapes (outline selectable, position unchanged by dragging) and empty shapes without an outline, locked or unlocked (#1621). Existing text, outline and interior-hit tests retained | | 2026-10-31 | No Fill shape interiors allow selection and editing of underlying objects, even when a quick style remains; hit-testing uses the renderer’s fill resolution. Outlines, rotation, text targets and actual fills keep their hit behaviour (#1621) | | 2026-10-30 | Print-preview tests use the URL emitted by egui and its exact file path; previews are explicitly removed before the macOS process exits | | 2026-10-30 | `slide.actions` lists shape click and hover actions and text-run hyperlinks (including table cells and grouped shapes) for audit; listing never runs an action. The UI pane is a follow-up | @@ -319,6 +320,7 @@ app's JSON control channel (`deckcraft --control PORT`). | Date | Change | Summary | |---|---|---| +| 2026-11-01 | trivial | No Fill tests cover locked outline selection without movement and click-through without an outline; fill row and parity scores unchanged (#1621) | | 2026-10-31 | trivial | No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged | | 2026-10-30 | trivial | Progress log: read-only slide action inspection; parity scores unchanged | | 2026-10-29 | trivial | Progress log: going back in the slide show reverses the left slide's transition (#1531). Scores and milestone names unchanged | diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 08417b4f8..aefd3473c 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -5572,7 +5572,7 @@ fn edit_points_conversion_is_one_undo_step() { assert!(preset(&s), "the only step was the conversion"); } -// #1621: No Fill changes hit-testing as well as rendering, even with a quick style. +/// #1621: build overlapping objects with an ordinary quick style on the foreground shape. fn no_fill_overlap(s: &mut Session, text: bool) -> (ShapeId, ShapeId) { s.execute("slide.new", &json!({"layout": "blank"})).unwrap(); let under = s @@ -5587,6 +5587,7 @@ fn no_fill_overlap(s: &mut Session, text: bool) -> (ShapeId, ShapeId) { (ShapeId(under as u32), ShapeId(over as u32)) } +/// No Fill passes interior clicks through while preserving outline and actual-fill targets. #[test] fn no_fill_shape_allows_selecting_and_editing_underlying_text() { let mut s = session(); @@ -5622,6 +5623,7 @@ fn no_fill_shape_allows_selecting_and_editing_underlying_text() { } } +/// Rotation and pointer tolerance must preserve both pass-through interiors and outline hits. #[test] fn no_fill_shape_hit_testing_respects_rotation_and_pointer_tolerance() { let mut s = session(); @@ -5642,6 +5644,7 @@ fn no_fill_shape_hit_testing_respects_rotation_and_pointer_tolerance() { } } +/// Style, theme and absent fills follow rendering, with explicit fill taking precedence. #[test] fn no_fill_hit_testing_resolves_style_and_theme_fills() { use std::sync::Arc; @@ -5673,6 +5676,7 @@ fn no_fill_hit_testing_resolves_style_and_theme_fills() { } } +/// Text on a foreground No Fill shape retains its selection and editing target. #[test] fn no_fill_text_shapes_keep_their_interior_text_target() { let mut s = session(); @@ -5686,6 +5690,52 @@ fn no_fill_text_shapes_keep_their_interior_text_target() { assert_eq!(text_sel(&s).unwrap().shape, over); } +/// A locked No Fill shape remains selectable on its outline, but dragging cannot move it. +#[test] +fn no_fill_locked_shape_keeps_outline_selection_without_moving() { + let mut s = session(); + let (under, over) = no_fill_overlap(&mut s, true); + s.execute("shape.fill", &json!({"none": true})).unwrap(); + s.execute("shape.lock", &json!({"locked": true})).unwrap(); + let before = s.doc().unwrap().shape(over).unwrap().xfrm; + s.execute("edit.deselect", &json!({})).unwrap(); + let inside = deckcraft_geom::Point::new(200.0, 310.0); + assert!(matches!(s.hit_test(inside, 3.0), Some(tools::Hit::Shape { id, .. }) if id == under)); + for kind in [PointerKind::Down, PointerKind::Up] { + s.pointer(tev(kind, inside.x, inside.y)).unwrap(); + } + assert_eq!(text_sel(&s).unwrap().shape, under); + s.execute("edit.deselect", &json!({})).unwrap(); + let edge = deckcraft_geom::Point::new(80.0, 330.0); + assert!(matches!(s.hit_test(edge, 3.0), Some(tools::Hit::Shape { id, .. }) if id == over)); + s.pointer(tev(PointerKind::Down, edge.x, edge.y)).unwrap(); + s.pointer(tev(PointerKind::Drag, edge.x + 40.0, edge.y + 20.0)).unwrap(); + s.pointer(tev(PointerKind::Up, edge.x + 40.0, edge.y + 20.0)).unwrap(); + let st = s.doc().unwrap(); + assert_eq!(st.selection.shapes, vec![over]); + assert_eq!(st.shape(over).unwrap().xfrm, before); + assert!(st.shape(over).unwrap().locked); +} + +/// Removing both fill and outline leaves the empty interior transparent to clicks, locked or not. +#[test] +fn no_fill_shape_without_text_or_outline_passes_interior_clicks() { + for locked in [false, true] { + let mut s = session(); + let (under, _) = no_fill_overlap(&mut s, false); + s.execute("shape.fill", &json!({"none": true})).unwrap(); + s.execute("shape.line", &json!({"none": true})).unwrap(); + s.execute("shape.lock", &json!({"locked": locked})).unwrap(); + s.execute("edit.deselect", &json!({})).unwrap(); + let p = deckcraft_geom::Point::new(200.0, 310.0); + assert!(matches!(s.hit_test(p, 3.0), Some(tools::Hit::Shape { id, .. }) if id == under)); + for kind in [PointerKind::Down, PointerKind::Up] { + s.pointer(tev(kind, p.x, p.y)).unwrap(); + } + assert_eq!(s.doc().unwrap().selection.shapes, vec![under]); + } +} + /// #931: while the text of a placeholder is being edited, a shape in front of it still takes a /// click (as in PowerPoint); a click on the text where nothing is in front still moves the caret. #[test] diff --git a/crates/engine/src/tools/hit.rs b/crates/engine/src/tools/hit.rs index 0e4b6ddcb..247ab1e79 100644 --- a/crates/engine/src/tools/hit.rs +++ b/crates/engine/src/tools/hit.rs @@ -216,6 +216,7 @@ pub(super) fn in_table_cell(st: &crate::DocState, id: ShapeId, p: Point) -> bool }) } +/// Resolve a shape's target at slide point `p`, using its effective fill for interior hits. pub(super) fn hit_shape(st: &crate::DocState, sh: &Shape, p: Point, tol: f64) -> Option { let x = xfrm_of(&st.doc, &st.selection, sh); let inv = x.affine().inverse(); diff --git a/docs/gaps.md b/docs/gaps.md index 3bc26cce7..77764f1cf 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Where DeckCraft falls short of PowerPoint -> **Last reviewed:** 2026-10-31 · **Last updated:** 2026-10-31 · **Change:** trivial (No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) +> **Last reviewed:** 2026-11-01 · **Last updated:** 2026-11-01 · **Change:** trivial (locked No Fill and no-outline click-through regression coverage added; No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) Every known shortfall, one entry each, ranked by how much it stops someone who presents with PowerPoint from switching. This is the work list: pick from the top. Numbers are summarized in @@ -368,6 +368,7 @@ Detail in [localization-parity.md](localization-parity.md). | Date | Change | Summary | |---|---|---| +| 2026-11-01 | trivial | No Fill tests cover locked outline selection without movement and click-through without an outline; fill row and parity scores unchanged (#1621) | | 2026-10-31 | trivial | No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged | | 2026-10-30 | minor | Slide-show click targets use each shape’s own animation state; scale and rotation test added | | 2026-10-28 | trivial | Automatic lists now run independently of Replace text as you type; proofing gap description updated | diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index c088bd018..f776f4aac 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -2,7 +2,7 @@ > **Generated:** 2026-10-14 (bullets/numbering remain D after empty-line marker review; summary by `cargo xtask parity`; rows re-scored by the 2026-10-14 community PR wave, duplicate Thesaurus, AutoCorrect, Artistic effects and Corrections rows folded; Preview in editor re-scored 2026-10-13; earlier rows re-scored 2026-10-10 against PowerPoint for Mac 16.113.4; video/animated GIF row re-scored 2026-10-11, #171) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) -> **Last updated:** 2026-10-31 · Fill row re-assessed after #1621: remains D; No Fill hit-testing now follows resolved appearance. Scores unchanged. +> **Last updated:** 2026-11-01 · Locked-shape and no-outline regressions added for #1621; fill row re-assessed: remains D; No Fill hit-testing now follows resolved appearance. Scores unchanged. The summary between ` **Weighted breadth parity: 84%** over 191 features. @@ -240,4 +240,5 @@ Open P0 items: Contextual tabs (Shape Format, Picture Format, Table Design/Layou | Date | Change | Summary | |---|---|---| +| 2026-11-01 | trivial | No Fill tests cover locked outline selection without movement and click-through without an outline; fill row and parity scores unchanged (#1621) | | 2026-10-31 | trivial | No Fill interior hit-testing follows resolved fill (#1621); fill row remains D and summary scores are unchanged | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index fa5f9ae88..fd34a7928 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI parity with PowerPoint -> **Last reviewed:** 2026-10-31 · **Last updated:** 2026-10-31 · **Change:** trivial (No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) +> **Last reviewed:** 2026-11-01 · **Last updated:** 2026-11-01 · **Change:** trivial (locked No Fill and no-outline click-through regression coverage added; No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-26 · **Change:** trivial (dragging several selected slides moves them all; previous: trivial, Edit Points: Shift, Ctrl/Cmd or Alt/Option on a handle drag sets the point type; previous: trivial, scroll bars on the zoomed slide pane, #1157; previous: major, community PR wave 2026-10-14: 14 new dialogs (41 in all), Eyedropper, Export button, New Window, Grid Options, WordArt gallery and handles, Slide Sorter sections, Quick Access Toolbar, Format Background and Format Shape depth, rich-text clipboard; duplicated rows and headers folded; previous: minor, File tab / Backstage, #76) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-22 · **Change:** trivial (group fill and outline edits reach members, #1079; scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-24 · **Change:** trivial (Edit Points: Shift, Ctrl/Cmd or Alt/Option on a handle drag sets the point type; previous: trivial, scroll bars on the zoomed slide pane, #1157; previous: major, community PR wave 2026-10-14: 14 new dialogs (41 in all), Eyedropper, Export button, New Window, Grid Options, WordArt gallery and handles, Slide Sorter sections, Quick Access Toolbar, Format Background and Format Shape depth, rich-text clipboard; duplicated rows and headers folded; previous: minor, File tab / Backstage, #76) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) @@ -81,7 +81,7 @@ menu colours taken from the theme tokens (menu `chrome`, page `card`). | Behaviour | PowerPoint | DeckCraft | |---|---|---| -| Selection handles, rotation handle, yellow adjustment handles | yes | yes; an empty No Fill shape passes interior clicks to underlying objects while its outline and handles remain selectable. Explicit, style and theme fills resolve as rendered (#1621) | +| Selection handles, rotation handle, yellow adjustment handles | yes | yes; an empty No Fill shape passes interior clicks to underlying objects while its outline and handles remain selectable. Explicit, style and theme fills resolve as rendered; tests also cover locked outline targets and empty interiors without an outline (#1621) | | Marquee, Shift/Cmd multi-select, Tab to cycle | yes | yes | | Objects off the slide: drawn on the area around it in Normal view (full strength, master graphics too), selectable and movable there; clipped in the show, exports and thumbnails | yes | yes (#270) | | Scroll bars on the slide pane when the zoomed slide is larger than the window | yes | yes, on each axis that overflows: drag the thumb or click the track; the wheel and trackpad still pan. The vertical bar does not turn the page (#1157) | @@ -171,6 +171,7 @@ consistency is open (#73, #56). | Date | Change | Summary | |---|---|---| +| 2026-11-01 | trivial | No Fill tests cover locked outline selection without movement and click-through without an outline; fill row and parity scores unchanged (#1621) | | 2026-10-31 | trivial | No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged | | 2026-10-29 | trivial | Picture Format: the Picture Styles row shows as many styles as fit beside the groups after it (at least two) and a More arrow with all 24, as the Transitions and Animations galleries do; Crop and Size are in view in the default window (#1232) | | 2026-10-26 | trivial | Thumbnail pane and Slide Sorter: dragging one of several selected slides moves the whole selection | From 5fb694d9917d232fbf5b2e0f42ac15d73febde7c Mon Sep 17 00:00:00 2001 From: xmaks82 Date: Sun, 1 Nov 2026 12:54:32 +0300 Subject: [PATCH 058/716] Text: a word doesn't break after ?, !, } or + (URLs wrap as in PowerPoint) (#924) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Text: a word doesn't break after ?, !, } or + (URLs wrap as in PowerPoint) Unicode line breaking allows a break after ?, !, } and + inside a word, so a long URL broke after its '?' and after each '+' of a query and left the rest of the line empty. Measured in PowerPoint 2016 for Windows with latinLnBrk off (its default), none of them is a break: the word fills the line and breaks where it no longer fits, as PowerPoint already does after / and \ (break_opportunities). The same synthetic slide now wraps line for line as PowerPoint's PDF does, a Yandex search URL included. * Text tests: the first line doesn't end at the separator * Text tests: check the line is full, not that it avoids ending at a separator * Keep the Unicode break after ?, !, / outside Latin words The PowerPoint no-break rule only holds inside a word: before an ideograph (日本!語) or punctuation the Unicode break stays, as CodeRabbit pointed out. * Only letters and digits continue a word for the no-break rule AL and AI also hold symbols such as & and ×, so a!&b kept no break after !. is_word_char now also requires c.is_alphanumeric() (CodeRabbit). * Test that Latin before CJK and a separator before a space still break --------- Co-authored-by: Магда М.Г. --- crates/text/src/breaking.rs | 15 ++++++++++++--- crates/text/src/tests.rs | 24 +++++++++++++++++++++--- docs/target-app-parity.md | 3 ++- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/crates/text/src/breaking.rs b/crates/text/src/breaking.rs index 36b9e5925..bb764b64c 100644 --- a/crates/text/src/breaking.rs +++ b/crates/text/src/breaking.rs @@ -82,9 +82,18 @@ fn is_cj_nonstarter(c: char) -> bool { ) } +/// A character that continues a Latin-style word: a letter or digit that Unicode does not break +/// between, as opposed to CJK ideographs, kana, spaces, punctuation and symbols such as `&` or `×` +/// (which share the AL and AI line-break classes with letters). +fn is_word_char(c: char) -> bool { + use unicode_linebreak::BreakClass::{Alphabetic, Ambiguous, HebrewLetter, Numeric}; + matches!(unicode_linebreak::break_property(c as u32), Alphabetic | Ambiguous | HebrewLetter | Numeric) && c.is_alphanumeric() +} + /// Break opportunities: allowed[i] = a line may start at char i. Unicode line breaking, then -/// PowerPoint's differences: without `latinLnBrk` a word doesn't break after `/` or `\`, and -/// Korean breaks only between words. +/// PowerPoint's differences: without `latinLnBrk` a word doesn't break after `/`, `\`, `?`, `!`, `}` +/// or `+` inside a word (measured in PowerPoint 2016 for Windows; before an ideograph or a space +/// the Unicode break stays), and Korean breaks only between words. pub(crate) fn break_opportunities(text: &str, latin_break: bool) -> (Vec, Vec) { let n = text.chars().count(); let mut allowed = vec![false; n + 1]; @@ -113,7 +122,7 @@ pub(crate) fn break_opportunities(text: &str, latin_break: bool) -> (Vec, let keep = if (is_hangul(prev) && is_hangul(next)) || prev == '\u{200B}' || next == '\u{2014}' || is_cj_nonstarter(next) { false } else { - latin_break || !matches!(prev, '/' | '\\') || next.is_whitespace() + latin_break || !matches!(prev, '/' | '\\' | '?' | '!' | '}' | '+') || !is_word_char(next) }; if !keep && !mandatory.get(i + 1).copied().unwrap_or(false) diff --git a/crates/text/src/tests.rs b/crates/text/src/tests.rs index f9f3f3101..656dfdb66 100644 --- a/crates/text/src/tests.rs +++ b/crates/text/src/tests.rs @@ -857,19 +857,37 @@ fn one_line(text: &str) -> f64 { #[test] fn a_word_does_not_break_after_a_slash_or_backslash() { // PowerPoint (latinLnBrk off, its default) keeps "alpha/beta/gamma" whole and only breaks it - // where it no longer fits; Unicode line breaking would allow a break after each slash. - for sep in ["/", "\\"] { + // where it no longer fits; Unicode line breaking would allow a break after each slash. The + // same holds after ?, !, } and + (a URL's query, measured in PowerPoint 2016 for Windows). + for sep in ["/", "\\", "?", "!", "}", "+"] { let text = ["alpha", "beta", "gamma", "delta", "epsilon"].join(sep); let w = one_line(&text) * 0.6; let lines = wrapped(&text, w, |_| {}); assert!(lines.len() >= 2, "{lines:?}"); assert!(lines[0].chars().count() > "alpha/beta".len(), "filled to the edge, not cut at a separator: {lines:?}"); + // The line breaks where the next character no longer fits, not at an earlier separator + // (it may still end with one when that is where the width runs out). + let next: String = lines[0].chars().chain(lines[1].chars().take(1)).collect(); + assert!(one_line(&next) > w, "no break right after {sep:?} while more fits: {lines:?}"); } // latinLnBrk on: Unicode's break after a slash is allowed again. let text = "alpha/beta/gamma/delta/epsilon"; let lines = wrapped(text, one_line(text) * 0.6, |p| p.latin_line_break = Some(true)); assert!(lines[0].ends_with('/'), "{lines:?}"); - // A slash followed by a space still breaks, and hyphens still break. + // Outside a Latin word the Unicode break stays: "日本!" fits, "語" moves to the next line. + let lines = wrapped("日本!語", one_line("日本!") + 0.5, |_| {}); + assert_eq!(lines[0], "日本!", "{lines:?}"); + // Nor before a symbol that only shares the letters' line-break class. + let (allowed, _) = break_opportunities("ab!&cd", false); + assert!(allowed[3], "break after ! before &: {allowed:?}"); + // Latin text before CJK still breaks after the mark: "ab?" fits, "日本" moves down. + let lines = wrapped("ab?日本", one_line("ab?") + 0.5, |_| {}); + assert_eq!(lines[0], "ab?", "{lines:?}"); + // A separator followed by a space still breaks, and hyphens still break. + for sep in ["/", "?", "!"] { + let lines = wrapped(&format!("alpha{sep} beta"), one_line(&format!("alpha{sep} b")) + 0.5, |_| {}); + assert_eq!(lines.iter().map(|l| l.trim_end()).collect::>(), [format!("alpha{sep}"), "beta".into()], "{lines:?}"); + } let lines = wrapped("alpha-beta-gamma-delta-epsilon", one_line("alpha-beta-gamma-") + 1.0, |_| {}); assert_eq!(lines[0], "alpha-beta-gamma-"); } diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 4f30ce5fe..33b631882 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # DeckCraft vs Microsoft PowerPoint: parity assessment -> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-22 · **Change:** trivial (Animations shortfall: preview from the selected effect is in; previous: major, community PR wave 2026-10-14: breadth 84% over 191 features (P0 92%, P1 82%, P2 55%) after `cargo xtask parity`; area table and What works today folded to one row or bullet each; 320 engine commands; ready ~55% and stage alpha unchanged; previous: minor, hours to ~95% per audience added) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) +> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-22 · **Change:** trivial (no break after `?`, `!`, `}`, `+` inside a word; previous: trivial, Animations shortfall: preview from the selected effect is in; before that: major, community PR wave 2026-10-14: breadth 84% over 191 features (P0 92%, P1 82%, P2 55%) after `cargo xtask parity`; area table and What works today folded to one row or bullet each; 320 engine commands; ready ~55% and stage alpha unchanged; previous: minor, hours to ~95% per audience added) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) The authoritative answer to "how close is DeckCraft to PowerPoint, and how much work is left?". [ROADMAP.md](../ROADMAP.md) summarizes it; [gaps.md](gaps.md) itemizes every shortfall; @@ -289,6 +289,7 @@ scored done (16 open issues). | Date | Change | Summary | |---|---|---| | 2026-10-22 | trivial | Animations shortfall: preview from the selected effect (Play From) is in. Percentages unchanged | +| 2026-10-17 | trivial | A word no longer breaks after `?`, `!`, `}` or `+` (a URL's query wraps at the edge as in PowerPoint 2016 for Windows), as it already didn't after `/` and `\`. Headline percentages unchanged | | 2026-10-16 | trivial | Arrange shortfall: Align to Slide and Align Selected Objects are in the Align menu. Percentages unchanged | | 2026-10-14 | minor | Community PR wave folded: one headline breadth row (84% over 191 features after `cargo xtask parity`; duplicate checklist rows removed), one row per feature area with the latest breadth and shortfalls, one Themes / Slide show / Views / Review / Automation bullet each (320 engine commands). SmartArt ready ~35% (Text Pane, 6e40335) moves the area mean to 62.8%; dimension and headline percentages unchanged | | 2026-10-13 | minor | Shapes shortfall "text warp" narrowed to adjust handles: the Transform gallery applies a preset | From 9f952550b2b3b3a56b6b23e7b2b02eafcbe06e45 Mon Sep 17 00:00:00 2001 From: scks1 <126534658+scks1@users.noreply.github.com> Date: Sun, 1 Nov 2026 08:58:11 -0500 Subject: [PATCH 059/716] #1596: add shadow, glow and reflection pixel goldens --- crates/render/src/lib.rs | 3 + crates/render/src/tests_effect_holes.rs | 198 ++++++++++++++++++++++++ 2 files changed, 201 insertions(+) create mode 100644 crates/render/src/tests_effect_holes.rs diff --git a/crates/render/src/lib.rs b/crates/render/src/lib.rs index 5fd011411..15b89ec57 100644 --- a/crates/render/src/lib.rs +++ b/crates/render/src/lib.rs @@ -94,6 +94,9 @@ mod tests; #[cfg(test)] mod tests_wild; +#[cfg(test)] +mod tests_effect_holes; + #[cfg(test)] mod mt_tests { use super::*; diff --git a/crates/render/src/tests_effect_holes.rs b/crates/render/src/tests_effect_holes.rs new file mode 100644 index 000000000..10749229d --- /dev/null +++ b/crates/render/src/tests_effect_holes.rs @@ -0,0 +1,198 @@ +//! Contributor-original pixel goldens for #1596 and the review of #1626. +//! The fixed samples cover background, hole/centre, ring, visible halos and reflected coverage. + +use super::{Fill, Image, RenderOpts, Rgba, render_slide}; +use deckcraft_model::style::{ColorRef, Effects, Glow, Line, Reflection, Shadow}; +use deckcraft_model::{Geom, Presentation, Shape, ShapeId, Xfrm}; + +const PROBES: [(u32, u32); 9] = [ + (20, 20), // Clear background. + (130, 130), // Clear donut hole; filled ellipse centre. + (130, 70), // Original ring/ellipse fill. + (130, 47), // Visible shadow/glow above the outer edge. + (130, 213), // Visible shadow/glow below the outer edge. + (130, 93), // Shadow/glow along the inner rim, inside the hole. + (130, 230), // Reflected upper ring. + (130, 300), // Reflected hole/ellipse centre. + (70, 300), // Reflected ring at the same fade as the hole. +]; + +#[derive(Clone, Copy, Debug)] +enum Effect { + Shadow, + Glow, + Reflection, +} + +fn scene(shape: &str, effect: Effect) -> Presentation { + let mut p = Presentation::default(); + let mut effects = Effects::default(); + match effect { + Effect::Shadow => { + effects.outer_shadow = Some(Shadow { + color: ColorRef::rgb(Rgba::BLACK), + blur: 8.0, + dist: 0.0, + dir: 45.0, + inner: false, + sx: 1.0, + sy: 1.0, + kx: 0.0, + ky: 0.0, + align: String::new(), + rotate_with_shape: false, + }) + } + Effect::Glow => effects.glow = Some(Glow { color: ColorRef::rgb(Rgba::rgb(255, 0, 0)), radius: 8.0 }), + Effect::Reflection => effects.reflection = Some(Reflection { blur: 0.0, start_alpha: 1.0, end_alpha: 0.0, end_pos: 1.0, dist: 10.0 }), + } + let slide = std::sync::Arc::make_mut(&mut p.slides[0]); + slide.background = Some(deckcraft_model::Background::Fill { fill: Fill::solid(ColorRef::rgb(Rgba::WHITE)) }); + slide.shapes = vec![Shape { + id: ShapeId(1596), + xfrm: Some(Xfrm::new(50.0, 50.0, 160.0, 160.0)), + geom: Geom::preset(shape), + fill: Some(Fill::solid(ColorRef::rgb(Rgba::rgb(32, 96, 224)))), + line: Some(Line::none()), + effects: Some(effects), + ..Default::default() + }]; + p +} + +fn draw(shape: &str, effect: Effect) -> Image { + let p = scene(shape, effect); + let image = render_slide(&p, 0, &RenderOpts { scale: 1.0, ..Default::default() }); + if let Ok(dir) = std::env::var("DECKCRAFT_EFFECT_HOLES_QA") { + use std::io::Write as _; + std::fs::create_dir_all(&dir).unwrap(); + let path = std::path::Path::new(&dir).join(format!("{shape}-{effect:?}.png")); + let mut file = std::fs::OpenOptions::new().write(true).create_new(true).open(path).unwrap(); + file.write_all(&image.to_png()).unwrap(); + } + image +} + +// Fixed contributor-original RGBA goldens; tolerate one final quantization step. +// The nonwhite halo/reflection samples also fail if an effect is disabled outright. +fn assert_golden(shape: &str, effect: Effect, expected: [[u8; 4]; 9]) { + let image = draw(shape, effect); + for ((x, y), want) in PROBES.into_iter().zip(expected) { + let got = image.pixel(x, y); + assert!(got.iter().zip(want).all(|(a, b)| (*a as i32 - b as i32).abs() <= 1), "{shape} {effect:?} at {x},{y}: {got:?} vs golden {want:?}"); + } +} + +#[test] +fn donut_shadow_matches_golden() { + assert_golden( + "donut", + Effect::Shadow, + [ + [255, 255, 255, 255], + [255, 255, 255, 255], + [32, 96, 224, 255], + [214, 214, 214, 255], + [233, 233, 233, 255], + [227, 227, 227, 255], + [255, 255, 255, 255], + [255, 255, 255, 255], + [255, 255, 255, 255], + ], + ); +} + +#[test] +fn donut_glow_matches_golden() { + assert_golden( + "donut", + Effect::Glow, + [ + [255, 255, 255, 255], + [255, 255, 255, 255], + [32, 96, 224, 255], + [255, 49, 49, 255], + [255, 111, 111, 255], + [255, 96, 96, 255], + [255, 255, 255, 255], + [255, 255, 255, 255], + [255, 255, 255, 255], + ], + ); +} + +#[test] +fn donut_reflection_matches_golden() { + assert_golden( + "donut", + Effect::Reflection, + [ + [255, 255, 255, 255], + [255, 255, 255, 255], + [32, 96, 224, 255], + [255, 255, 255, 255], + [255, 255, 255, 255], + [255, 255, 255, 255], + [130, 166, 238, 255], + [255, 255, 255, 255], + [189, 208, 246, 255], + ], + ); +} + +#[test] +fn ellipse_shadow_matches_golden() { + assert_golden( + "ellipse", + Effect::Shadow, + [ + [255, 255, 255, 255], + [32, 96, 224, 255], + [32, 96, 224, 255], + [214, 214, 214, 255], + [233, 233, 233, 255], + [32, 96, 224, 255], + [255, 255, 255, 255], + [255, 255, 255, 255], + [255, 255, 255, 255], + ], + ); +} + +#[test] +fn ellipse_glow_matches_golden() { + assert_golden( + "ellipse", + Effect::Glow, + [ + [255, 255, 255, 255], + [32, 96, 224, 255], + [32, 96, 224, 255], + [255, 49, 49, 255], + [255, 111, 111, 255], + [32, 96, 224, 255], + [255, 255, 255, 255], + [255, 255, 255, 255], + [255, 255, 255, 255], + ], + ); +} + +#[test] +fn ellipse_reflection_matches_golden() { + assert_golden( + "ellipse", + Effect::Reflection, + [ + [255, 255, 255, 255], + [32, 96, 224, 255], + [32, 96, 224, 255], + [255, 255, 255, 255], + [255, 255, 255, 255], + [32, 96, 224, 255], + [130, 166, 238, 255], + [189, 208, 246, 255], + [189, 208, 246, 255], + ], + ); +} From 650c4f949786a991247b2c6744d446a25cbab573 Mon Sep 17 00:00:00 2001 From: scks1 <126534658+scks1@users.noreply.github.com> Date: Sun, 1 Nov 2026 08:58:13 -0500 Subject: [PATCH 060/716] #1597: make validation independent of installed fonts and dictionaries --- crates/pdf/src/tests.rs | 5 ++++- crates/ui-egui/src/tests.rs | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/pdf/src/tests.rs b/crates/pdf/src/tests.rs index 8bdbbce93..ba5cd7d7b 100644 --- a/crates/pdf/src/tests.rs +++ b/crates/pdf/src/tests.rs @@ -202,7 +202,10 @@ fn unsafe_url_links_are_not_exported() { /// memory. Its naming/shaping tables still parse, but its missing head table prevents PDF /// embedding. No font bytes or vendor assets are stored as test fixtures. fn font_without_head() -> Vec { - let mut bytes = FontDb::global().face("Ubuntu", "Regular").data().to_vec(); + // An installed variable Ubuntu can expose many faces; use the bundled static + // Light face so the damaged fixture always adds exactly one face. + let bundled = FontDb::with_font_dirs(Vec::new()); + let mut bytes = bundled.face("Ubuntu", "Light").data().to_vec(); for (old, new) in [(b"Ubuntu".as_slice(), b"BadPDF".as_slice()), (b"\0U\0b\0u\0n\0t\0u".as_slice(), b"\0B\0a\0d\0P\0D\0F".as_slice())] { let mut offset = 0; while offset + old.len() <= bytes.len() { diff --git a/crates/ui-egui/src/tests.rs b/crates/ui-egui/src/tests.rs index 98f3b85c7..29fa755fd 100644 --- a/crates/ui-egui/src/tests.rs +++ b/crates/ui-egui/src/tests.rs @@ -999,7 +999,8 @@ fn the_language_dialog_marks_the_selected_text() { harness.state_mut().run("app.dialog", json!({"id": "language"})).unwrap(); // The anchored window settles over its first frames; click once it stays put. harness.run_steps(4); - harness.get_by_label("Français (France)").click(); + // Installed dictionaries append a marker to the language's accessible label. + harness.get_by_label_contains("Français (France)").click(); harness.run_steps(2); harness.get_by_label("OK").click(); harness.run_steps(2); From 14cc73101b37a7c2305ff3763a29eaf28bd72eaa Mon Sep 17 00:00:00 2001 From: SusieeTheFemboy <96988330+SusieeTheLinuxUser@users.noreply.github.com> Date: Sun, 1 Nov 2026 16:46:05 +0100 Subject: [PATCH 061/716] H.264: cite temporal direct as 8.4.1.2.3 Co-Authored-By: Claude Opus 5.5 --- crates/h264/src/slicedec.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/h264/src/slicedec.rs b/crates/h264/src/slicedec.rs index 2ada51594..557a94d46 100644 --- a/crates/h264/src/slicedec.rs +++ b/crates/h264/src/slicedec.rs @@ -566,7 +566,7 @@ impl<'a> SliceDecoder<'a> { (refs, mvs, false) } - /// Temporal direct mvs (8.4.1.2.4) from the co-located mv and `DistScaleFactor` (clamped + /// Temporal direct mvs (8.4.1.2.3) from the co-located mv and `DistScaleFactor` (clamped /// to ±1024 in `SliceDecoder`): mvL0 = clip_mv((mvCol · dsf + 128) >> 8), mvL1 = /// clip_mv(mvL0 − mvCol), both clipped to the spec's motion-vector range −2^15..2^15−1. /// The i32 maths cannot overflow; a truncating `as i16` used to wrap mvL0 past the range, From f2f0c4373d2ac6ff707b42658909524796a582c9 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 1 Nov 2026 12:30:03 -0500 Subject: [PATCH 062/716] docs: sync Craft App Suite list with ArtCraft Launcher --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0cdfc5842..730165a8e 100644 --- a/README.md +++ b/README.md @@ -286,7 +286,15 @@ stand on its own. | | **PdfCraft** | Reading, organizing and protecting PDFs | [GitHub](https://github.com/storytold/pdfcraft) | [Website](https://getartcraft.com/apps/pdfcraft) | | | **EffectCraft** | Motion graphics and visual effects | [GitHub](https://github.com/storytold/effectcraft) | [Website](https://getartcraft.com/apps/effectcraft) | | | **DesignCraft** | Page layout and publishing | [GitHub](https://github.com/storytold/designcraft) | [Website](https://getartcraft.com/apps/designcraft) | -| | **DeckCraft** | **Presentations and slide shows · you are here** | [GitHub](https://github.com/storytold/deckcraft) | [Website](https://getartcraft.com/apps/deckcraft) | +| | **FigCraft** | Interface design and prototyping | [GitHub](https://github.com/storytold/figcraft) | [Website](https://getartcraft.com/apps/figcraft) | +| | **WordCraft** | Word processing and documents | [GitHub](https://github.com/storytold/wordcraft) | [Website](https://getartcraft.com/apps/wordcraft) | +| | **SoundCraft** | Audio recording and editing | [GitHub](https://github.com/storytold/soundcraft) | [Website](https://getartcraft.com/apps/soundcraft) | +| | **DeckCraft** | Presentations and slide decks | [GitHub](https://github.com/storytold/deckcraft) | [Website](https://getartcraft.com/apps/deckcraft) | +| | **CADCraft** | Computer-aided design | [GitHub](https://github.com/storytold/cadcraft) | [Website](https://getartcraft.com/apps/cadcraft) | +| | **GridCraft** | Spreadsheets and data | [GitHub](https://github.com/storytold/gridcraft) | [Website](https://getartcraft.com/apps/gridcraft) | +| | **TextureCraft** | 3D texture painting | [GitHub](https://github.com/storytold/texturecraft) | [Website](https://getartcraft.com/apps/texturecraft) | +| | **Craft Anything** | See how any software works, then build your own | [GitHub](https://github.com/storytold/craft-anything) | [Website](https://getartcraft.com/apps/craft-anything) | +| | **SolidCraft** | Parametric 3D CAD by Tangency Labs (community app) | [GitHub](https://github.com/tangency-labs/solidcraft) | | And [**ArtCraft**](https://getartcraft.com/) itself, our AI image and video studio for artists who want real control. From eaf8d1ce3f9e872b7c728d2cf3ca780e7fc1afd6 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sun, 1 Nov 2026 13:57:23 -0500 Subject: [PATCH 063/716] Release 0.14.0 Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 56 +++++++++++++++++++++++++++--------------------------- Cargo.toml | 2 +- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4c7e15203..73388603e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -984,7 +984,7 @@ checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" [[package]] name = "deckcraft" -version = "0.13.1" +version = "0.14.0" dependencies = [ "arboard", "chrono", @@ -1006,7 +1006,7 @@ dependencies = [ [[package]] name = "deckcraft-anim" -version = "0.13.1" +version = "0.14.0" dependencies = [ "deckcraft-geom", "deckcraft-model", @@ -1015,7 +1015,7 @@ dependencies = [ [[package]] name = "deckcraft-av1" -version = "0.13.1" +version = "0.14.0" dependencies = [ "deckcraft-bitstream", "rayon", @@ -1024,14 +1024,14 @@ dependencies = [ [[package]] name = "deckcraft-bitstream" -version = "0.13.1" +version = "0.14.0" dependencies = [ "craft-media", ] [[package]] name = "deckcraft-cli" -version = "0.13.1" +version = "0.14.0" dependencies = [ "deckcraft-engine", "deckcraft-mcp", @@ -1041,14 +1041,14 @@ dependencies = [ [[package]] name = "deckcraft-color" -version = "0.13.1" +version = "0.14.0" dependencies = [ "serde", ] [[package]] name = "deckcraft-engine" -version = "0.13.1" +version = "0.14.0" dependencies = [ "chrono", "deckcraft-anim", @@ -1074,7 +1074,7 @@ dependencies = [ [[package]] name = "deckcraft-fonts" -version = "0.13.1" +version = "0.14.0" dependencies = [ "epaint_default_fonts", "harfrust 0.13.3", @@ -1086,7 +1086,7 @@ dependencies = [ [[package]] name = "deckcraft-format" -version = "0.13.1" +version = "0.14.0" dependencies = [ "deckcraft-model", "serde", @@ -1097,7 +1097,7 @@ dependencies = [ [[package]] name = "deckcraft-geom" -version = "0.13.1" +version = "0.14.0" dependencies = [ "kurbo", "serde", @@ -1105,7 +1105,7 @@ dependencies = [ [[package]] name = "deckcraft-h264" -version = "0.13.1" +version = "0.14.0" dependencies = [ "deckcraft-bitstream", "rayon", @@ -1114,7 +1114,7 @@ dependencies = [ [[package]] name = "deckcraft-hevc" -version = "0.13.1" +version = "0.14.0" dependencies = [ "deckcraft-bitstream", "rayon", @@ -1123,21 +1123,21 @@ dependencies = [ [[package]] name = "deckcraft-isobmff" -version = "0.13.1" +version = "0.14.0" dependencies = [ "craft-media", ] [[package]] name = "deckcraft-matroska" -version = "0.13.1" +version = "0.14.0" dependencies = [ "craft-media", ] [[package]] name = "deckcraft-mcp" -version = "0.13.1" +version = "0.14.0" dependencies = [ "deckcraft-engine", "deckcraft-render", @@ -1147,7 +1147,7 @@ dependencies = [ [[package]] name = "deckcraft-media" -version = "0.13.1" +version = "0.14.0" dependencies = [ "deckcraft-av1", "deckcraft-h264", @@ -1165,7 +1165,7 @@ dependencies = [ [[package]] name = "deckcraft-metafile" -version = "0.13.1" +version = "0.14.0" dependencies = [ "image", "kurbo", @@ -1174,7 +1174,7 @@ dependencies = [ [[package]] name = "deckcraft-model" -version = "0.13.1" +version = "0.14.0" dependencies = [ "deckcraft-color", "deckcraft-geom", @@ -1186,15 +1186,15 @@ dependencies = [ [[package]] name = "deckcraft-ogg" -version = "0.13.1" +version = "0.14.0" [[package]] name = "deckcraft-opus" -version = "0.13.1" +version = "0.14.0" [[package]] name = "deckcraft-pdf" -version = "0.13.1" +version = "0.14.0" dependencies = [ "craft-pdf", "deckcraft-fonts", @@ -1212,7 +1212,7 @@ dependencies = [ [[package]] name = "deckcraft-pptx" -version = "0.13.1" +version = "0.14.0" dependencies = [ "deckcraft-color", "deckcraft-engine", @@ -1228,7 +1228,7 @@ dependencies = [ [[package]] name = "deckcraft-render" -version = "0.13.1" +version = "0.14.0" dependencies = [ "deckcraft-anim", "deckcraft-color", @@ -1247,7 +1247,7 @@ dependencies = [ [[package]] name = "deckcraft-text" -version = "0.13.1" +version = "0.14.0" dependencies = [ "chrono", "deckcraft-color", @@ -1261,7 +1261,7 @@ dependencies = [ [[package]] name = "deckcraft-ui-egui" -version = "0.13.1" +version = "0.14.0" dependencies = [ "craft-ui", "craft-update", @@ -1286,7 +1286,7 @@ dependencies = [ [[package]] name = "deckcraft-vp9" -version = "0.13.1" +version = "0.14.0" dependencies = [ "deckcraft-bitstream", "rayon", @@ -1295,7 +1295,7 @@ dependencies = [ [[package]] name = "deckcraft-web" -version = "0.13.1" +version = "0.14.0" dependencies = [ "deckcraft-engine", "deckcraft-ui-egui", @@ -6177,7 +6177,7 @@ checksum = "9440ea3e5aeabb0ac63af70daf835274065238cdd0cec83418f417eae38bacee" [[package]] name = "xtask" -version = "0.13.1" +version = "0.14.0" dependencies = [ "serde_json", ] diff --git a/Cargo.toml b/Cargo.toml index 83d5d06bd..a814e4cc2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ members = ["crates/*", "apps/*", "xtask"] default-members = ["crates/*", "apps/deckcraft", "apps/deckcraft-cli"] [workspace.package] -version = "0.13.1" +version = "0.14.0" edition = "2024" license = "MIT OR Apache-2.0" rust-version = "1.95" From bbd579813fdf4d64e002ce9efd2c8de24becea06 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sun, 1 Nov 2026 14:14:20 -0500 Subject: [PATCH 064/716] packaging(flatpak): flatpak-oci.sh sources common.sh, not the absent env.sh Co-Authored-By: Claude Opus 5.5 --- packaging/linux/flatpak-oci.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/linux/flatpak-oci.sh b/packaging/linux/flatpak-oci.sh index 5dd360353..a02f06063 100755 --- a/packaging/linux/flatpak-oci.sh +++ b/packaging/linux/flatpak-oci.sh @@ -10,8 +10,8 @@ # TAG Target image tag (default: $VERSION-$ARCH, also tags stable-$ARCH) # GITHUB_TOKEN Token for GHCR authentication when --push is used set -euo pipefail -# shellcheck source=../env.sh -. "$(dirname "${BASH_SOURCE[0]}")/../env.sh" +# shellcheck source=../common.sh +. "$(dirname "${BASH_SOURCE[0]}")/../common.sh" HERE="$ROOT/packaging/linux" PUSH=0 From ee39ff67816d0039143ec7c98ea604cefe0cd2e5 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sun, 1 Nov 2026 14:14:22 -0500 Subject: [PATCH 065/716] Release 0.14.1 Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 56 +++++++++++++++++++++++++++--------------------------- Cargo.toml | 2 +- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 73388603e..408e99948 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -984,7 +984,7 @@ checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" [[package]] name = "deckcraft" -version = "0.14.0" +version = "0.14.1" dependencies = [ "arboard", "chrono", @@ -1006,7 +1006,7 @@ dependencies = [ [[package]] name = "deckcraft-anim" -version = "0.14.0" +version = "0.14.1" dependencies = [ "deckcraft-geom", "deckcraft-model", @@ -1015,7 +1015,7 @@ dependencies = [ [[package]] name = "deckcraft-av1" -version = "0.14.0" +version = "0.14.1" dependencies = [ "deckcraft-bitstream", "rayon", @@ -1024,14 +1024,14 @@ dependencies = [ [[package]] name = "deckcraft-bitstream" -version = "0.14.0" +version = "0.14.1" dependencies = [ "craft-media", ] [[package]] name = "deckcraft-cli" -version = "0.14.0" +version = "0.14.1" dependencies = [ "deckcraft-engine", "deckcraft-mcp", @@ -1041,14 +1041,14 @@ dependencies = [ [[package]] name = "deckcraft-color" -version = "0.14.0" +version = "0.14.1" dependencies = [ "serde", ] [[package]] name = "deckcraft-engine" -version = "0.14.0" +version = "0.14.1" dependencies = [ "chrono", "deckcraft-anim", @@ -1074,7 +1074,7 @@ dependencies = [ [[package]] name = "deckcraft-fonts" -version = "0.14.0" +version = "0.14.1" dependencies = [ "epaint_default_fonts", "harfrust 0.13.3", @@ -1086,7 +1086,7 @@ dependencies = [ [[package]] name = "deckcraft-format" -version = "0.14.0" +version = "0.14.1" dependencies = [ "deckcraft-model", "serde", @@ -1097,7 +1097,7 @@ dependencies = [ [[package]] name = "deckcraft-geom" -version = "0.14.0" +version = "0.14.1" dependencies = [ "kurbo", "serde", @@ -1105,7 +1105,7 @@ dependencies = [ [[package]] name = "deckcraft-h264" -version = "0.14.0" +version = "0.14.1" dependencies = [ "deckcraft-bitstream", "rayon", @@ -1114,7 +1114,7 @@ dependencies = [ [[package]] name = "deckcraft-hevc" -version = "0.14.0" +version = "0.14.1" dependencies = [ "deckcraft-bitstream", "rayon", @@ -1123,21 +1123,21 @@ dependencies = [ [[package]] name = "deckcraft-isobmff" -version = "0.14.0" +version = "0.14.1" dependencies = [ "craft-media", ] [[package]] name = "deckcraft-matroska" -version = "0.14.0" +version = "0.14.1" dependencies = [ "craft-media", ] [[package]] name = "deckcraft-mcp" -version = "0.14.0" +version = "0.14.1" dependencies = [ "deckcraft-engine", "deckcraft-render", @@ -1147,7 +1147,7 @@ dependencies = [ [[package]] name = "deckcraft-media" -version = "0.14.0" +version = "0.14.1" dependencies = [ "deckcraft-av1", "deckcraft-h264", @@ -1165,7 +1165,7 @@ dependencies = [ [[package]] name = "deckcraft-metafile" -version = "0.14.0" +version = "0.14.1" dependencies = [ "image", "kurbo", @@ -1174,7 +1174,7 @@ dependencies = [ [[package]] name = "deckcraft-model" -version = "0.14.0" +version = "0.14.1" dependencies = [ "deckcraft-color", "deckcraft-geom", @@ -1186,15 +1186,15 @@ dependencies = [ [[package]] name = "deckcraft-ogg" -version = "0.14.0" +version = "0.14.1" [[package]] name = "deckcraft-opus" -version = "0.14.0" +version = "0.14.1" [[package]] name = "deckcraft-pdf" -version = "0.14.0" +version = "0.14.1" dependencies = [ "craft-pdf", "deckcraft-fonts", @@ -1212,7 +1212,7 @@ dependencies = [ [[package]] name = "deckcraft-pptx" -version = "0.14.0" +version = "0.14.1" dependencies = [ "deckcraft-color", "deckcraft-engine", @@ -1228,7 +1228,7 @@ dependencies = [ [[package]] name = "deckcraft-render" -version = "0.14.0" +version = "0.14.1" dependencies = [ "deckcraft-anim", "deckcraft-color", @@ -1247,7 +1247,7 @@ dependencies = [ [[package]] name = "deckcraft-text" -version = "0.14.0" +version = "0.14.1" dependencies = [ "chrono", "deckcraft-color", @@ -1261,7 +1261,7 @@ dependencies = [ [[package]] name = "deckcraft-ui-egui" -version = "0.14.0" +version = "0.14.1" dependencies = [ "craft-ui", "craft-update", @@ -1286,7 +1286,7 @@ dependencies = [ [[package]] name = "deckcraft-vp9" -version = "0.14.0" +version = "0.14.1" dependencies = [ "deckcraft-bitstream", "rayon", @@ -1295,7 +1295,7 @@ dependencies = [ [[package]] name = "deckcraft-web" -version = "0.14.0" +version = "0.14.1" dependencies = [ "deckcraft-engine", "deckcraft-ui-egui", @@ -6177,7 +6177,7 @@ checksum = "9440ea3e5aeabb0ac63af70daf835274065238cdd0cec83418f417eae38bacee" [[package]] name = "xtask" -version = "0.14.0" +version = "0.14.1" dependencies = [ "serde_json", ] diff --git a/Cargo.toml b/Cargo.toml index a814e4cc2..7cd456fdf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ members = ["crates/*", "apps/*", "xtask"] default-members = ["crates/*", "apps/deckcraft", "apps/deckcraft-cli"] [workspace.package] -version = "0.14.0" +version = "0.14.1" edition = "2024" license = "MIT OR Apache-2.0" rust-version = "1.95" From 90058395b78be26bb7ea7b4914a9f113c28d979d Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Sun, 1 Nov 2026 21:36:45 +0100 Subject: [PATCH 066/716] WASM: open presenter view in a separate browser window (#729) (#730) * docs: track WASM presenter popout work (#729) * Fix presenter transport retries and initialize popup note fonts * Clarify optional font coverage and source-verified popup lifecycle --------- Co-authored-by: FredApps --- apps/deckcraft-web/Cargo.toml | 2 +- apps/deckcraft-web/src/main.rs | 2 + apps/deckcraft-web/src/presenter.rs | 303 +++++++++++++++++++ apps/deckcraft-web/src/web.rs | 17 ++ crates/engine/src/recovery.rs | 10 + crates/pdf/src/tests.rs | 3 +- crates/ui-egui/src/lib.rs | 1 + crates/ui-egui/src/presenter.rs | 450 ++++++++++++++++++++++++++++ crates/ui-egui/src/services.rs | 2 + crates/ui-egui/src/show.rs | 8 + crates/ui-egui/src/show/keys.rs | 21 +- crates/ui-egui/src/show/tests.rs | 60 ++++ crates/ui-egui/src/show/ui.rs | 85 +++++- docs/wasm-presenter-popout-729.md | 65 ++++ 14 files changed, 1018 insertions(+), 11 deletions(-) create mode 100644 apps/deckcraft-web/src/presenter.rs create mode 100644 crates/ui-egui/src/presenter.rs create mode 100644 docs/wasm-presenter-popout-729.md diff --git a/apps/deckcraft-web/Cargo.toml b/apps/deckcraft-web/Cargo.toml index 7014421d8..541985e5b 100644 --- a/apps/deckcraft-web/Cargo.toml +++ b/apps/deckcraft-web/Cargo.toml @@ -27,4 +27,4 @@ rfd = { workspace = true } wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" js-sys = "0.3" -web-sys = { version = "0.3", features = ["Window", "Document", "Element", "HtmlElement", "HtmlCanvasElement", "HtmlAnchorElement", "Blob", "BlobPropertyBag", "Url", "Location", "CssStyleDeclaration"] } +web-sys = { version = "0.3", features = ["Window", "Document", "Element", "HtmlElement", "HtmlCanvasElement", "HtmlAnchorElement", "Blob", "BlobPropertyBag", "Url", "Location", "CssStyleDeclaration", "MessageEvent", "Event", "EventTarget"] } diff --git a/apps/deckcraft-web/src/main.rs b/apps/deckcraft-web/src/main.rs index 6d2b7e943..2ce622e9a 100644 --- a/apps/deckcraft-web/src/main.rs +++ b/apps/deckcraft-web/src/main.rs @@ -18,6 +18,8 @@ #![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] #![forbid(unsafe_code)] +#[cfg(target_arch = "wasm32")] +mod presenter; #[cfg(target_arch = "wasm32")] mod web; diff --git a/apps/deckcraft-web/src/presenter.rs b/apps/deckcraft-web/src/presenter.rs new file mode 100644 index 000000000..1ec9a298c --- /dev/null +++ b/apps/deckcraft-web/src/presenter.rs @@ -0,0 +1,303 @@ +//! Same-origin popup transport. Each window starts its own eframe/WASM runner. +use deckcraft_ui_egui::presenter::{Command, DeltaCache, Host, Snapshot, View}; +use std::{ + cell::RefCell, + collections::VecDeque, + rc::{Rc, Weak}, +}; +use wasm_bindgen::{JsCast, closure::Closure}; + +const MAX_MESSAGE: usize = 16 * 1024 * 1024; +const MAX_COMMANDS: usize = 64; +const PREFIX: &str = "#deckcraft-presenter="; +fn error(e: wasm_bindgen::JsValue) -> String { + format!("{e:?}") +} +fn origin() -> Result { + web_sys::window().ok_or("No browser window")?.location().origin().map_err(error) +} +pub fn token() -> Option { + let hash = web_sys::window()?.location().hash().ok()?; + let token = hash.strip_prefix(PREFIX)?; + (!token.is_empty() && token.len() < 128).then(|| token.to_owned()) +} +fn same_source(event: &web_sys::MessageEvent, window: &web_sys::Window, expected_origin: &str) -> bool { + event.origin() == expected_origin && event.source().is_some_and(|source| js_sys::Object::is(source.as_ref(), window.as_ref())) +} +fn send(window: &web_sys::Window, origin: &str, value: serde_json::Value) -> Result<(), String> { + let text = serde_json::to_string(&value).map_err(|e| e.to_string())?; + if text.len() > MAX_MESSAGE { + return Err("Presenter message is too large".into()); + } + window.post_message(&wasm_bindgen::JsValue::from_str(&text), origin).map_err(error) +} +struct State { + popup: Option, + token: String, + commands: VecDeque, + ready: bool, + refresh_images: bool, +} +pub struct BrowserHost { + state: Rc>, + origin: String, + listener: Closure, + button: Option<(web_sys::HtmlElement, Closure)>, + images: DeltaCache, +} +impl BrowserHost { + pub fn new(ctx: egui::Context) -> Result { + let window = web_sys::window().ok_or("No browser window")?; + let origin = origin()?; + let state = Rc::new(RefCell::new(State { popup: None, token: String::new(), commands: VecDeque::new(), ready: false, refresh_images: true })); + let weak = Rc::downgrade(&state); + let expected = origin.clone(); + let listener = Closure::new(move |event: web_sys::MessageEvent| { + let Some(state) = weak.upgrade() else { return }; + let Ok(mut state) = state.try_borrow_mut() else { return }; + let Some(popup) = state.popup.as_ref() else { return }; + if !same_source(&event, popup, &expected) { + return; + } + let Some(text) = event.data().as_string().filter(|s| s.len() <= 8192) else { return }; + let Ok(value) = serde_json::from_str::(&text) else { return }; + if value.get("token").and_then(|v| v.as_str()) != Some(state.token.as_str()) { + return; + } + match value.get("kind").and_then(|v| v.as_str()) { + Some("ready") => { + state.ready = true; + state.refresh_images = true; + } + Some("command") if state.commands.len() < MAX_COMMANDS => { + if let Some(command) = value.get("command").and_then(|v| serde_json::from_value(v.clone()).ok()) { + state.commands.push_back(command); + } + } + _ => {} + } + ctx.request_repaint(); + }); + window.add_event_listener_with_callback("message", listener.as_ref().unchecked_ref()).map_err(error)?; + Ok(Self { state, origin, listener, button: None, images: DeltaCache::default() }) + } + fn remove_button(&mut self) { + if let Some((button, callback)) = self.button.take() { + let _ = button.remove_event_listener_with_callback("click", callback.as_ref().unchecked_ref()); + button.remove(); + } + } + fn recovery_button(&mut self) { + if self.button.is_some() { + return; + } + let Some(document) = web_sys::window().and_then(|w| w.document()) else { return }; + let Some(body) = document.body() else { return }; + let Ok(element) = document.create_element("button") else { return }; + let Ok(button) = element.dyn_into::() else { return }; + button.set_text_content(Some("Open presenter window")); + let _ = button.set_attribute("style", "position:fixed;top:12px;right:12px;z-index:9999;padding:12px;color:white;background:#333;border:1px solid #aaa;border-radius:4px;cursor:pointer"); + let weak: Weak> = Rc::downgrade(&self.state); + let button_copy = button.clone(); + let callback = Closure::new(move |_event: web_sys::Event| { + if let Some(state) = weak.upgrade() { + match open_popup(&state) { + Ok(()) => { + button_copy.set_text_content(Some("Opening presenter window…")); + } + Err(_) => { + button_copy.set_text_content(Some("Popup blocked. Allow popups, then click to retry.")); + } + } + } + }); + if button.add_event_listener_with_callback("click", callback.as_ref().unchecked_ref()).is_ok() && body.append_child(&button).is_ok() { + self.button = Some((button, callback)); + } else { + let _ = button.remove_event_listener_with_callback("click", callback.as_ref().unchecked_ref()); + button.remove(); + } + } +} +fn open_popup(state: &Rc>) -> Result<(), String> { + let window = web_sys::window().ok_or("No browser window")?; + let mut state = state.try_borrow_mut().map_err(|_| "Presenter is busy")?; + if let Some(popup) = &state.popup + && !popup.closed().unwrap_or(true) + { + let _ = popup.focus(); + return Ok(()); + } + let token = format!("{}-{}", js_sys::Date::now(), js_sys::Math::random()); + let url = web_sys::Url::new(&window.location().href().map_err(error)?).map_err(error)?; + url.set_hash(&format!("{PREFIX}{token}")); + let popup = window + .open_with_url_and_target_and_features(&url.href(), "_blank", "popup,width=1100,height=700") + .map_err(error)? + .ok_or("Presenter popup was blocked. Use Open presenter window to retry.")?; + if popup.closed().unwrap_or(true) { + return Err("Browser isolation prevented connecting the presenter window".into()); + } + state.popup = Some(popup); + state.token = token; + state.commands.clear(); + state.ready = false; + Ok(()) +} +impl Host for BrowserHost { + fn open(&mut self) -> Result<(), String> { + self.close(); + let result = open_popup(&self.state); + if result.is_err() { + self.recovery_button(); + } + result + } + fn is_open(&self) -> bool { + self.state.borrow().popup.as_ref().is_some_and(|w| !w.closed().unwrap_or(true)) + } + fn commands(&mut self) -> Vec { + self.state.borrow_mut().commands.drain(..).collect() + } + fn update(&mut self, snapshot: Snapshot) { + if !self.is_open() { + self.recovery_button(); + return; + } + self.remove_button(); + let mut state = self.state.borrow_mut(); + if !state.ready { + return; + } + if let Some(popup) = state.popup.clone() { + let token = state.token.clone(); + let sent = self.images.send(snapshot, &token, state.refresh_images, |delta, current_changed, next_changed| { + send( + &popup, + &self.origin, + serde_json::json!({"kind":"snapshot", "token":token, "snapshot":delta, + "currentChanged":current_changed, "nextChanged":next_changed}), + ) + }); + if sent.is_ok() { + state.refresh_images = false; + } + } + } + fn close(&mut self) { + self.remove_button(); + let mut state = self.state.borrow_mut(); + if let Some(window) = state.popup.take() { + let _ = window.close(); + } + state.commands.clear(); + state.ready = false; + state.token.clear(); + } +} +impl Drop for BrowserHost { + fn drop(&mut self) { + self.close(); + if let Some(window) = web_sys::window() { + let _ = window.remove_event_listener_with_callback("message", self.listener.as_ref().unchecked_ref()); + } + } +} + +pub struct Popup { + token: String, + origin: String, + opener: web_sys::Window, + snapshot: Rc>>, + last_received: Rc>, + listener: Closure, + view: View, +} +impl Popup { + pub fn new(token: String, ctx: egui::Context) -> Result { + let window = web_sys::window().ok_or("No browser window")?; + // `opener` is a WindowProxy from another realm; instanceof Window can fail across + // realms. The browser API supplies a WindowProxy or null, and messages still verify + // exact source identity and origin before any data is accepted. + let opener = window.opener().map_err(error)?; + if opener.is_null() || opener.is_undefined() { + return Err("The audience window is unavailable".into()); + } + let opener: web_sys::Window = opener.unchecked_into(); + let origin = origin()?; + let snapshot: Rc>> = Rc::new(RefCell::new(None)); + let last_received = Rc::new(RefCell::new(js_sys::Date::now())); + let received = last_received.clone(); + let target = snapshot.clone(); + let expected_origin = origin.clone(); + let expected_opener = opener.clone(); + let expected_token = token.clone(); + let listener = Closure::new(move |event: web_sys::MessageEvent| { + if !same_source(&event, &expected_opener, &expected_origin) { + return; + } + let Some(text) = event.data().as_string().filter(|s| s.len() <= MAX_MESSAGE) else { return }; + let Ok(value) = serde_json::from_str::(&text) else { return }; + if value.get("token").and_then(|v| v.as_str()) != Some(expected_token.as_str()) + || value.get("kind").and_then(|v| v.as_str()) != Some("snapshot") + { + return; + } + if let Some(mut data) = value.get("snapshot").and_then(|v| serde_json::from_value::(v.clone()).ok()) { + if let Some(previous) = target.borrow().as_ref() { + if value.get("currentChanged").and_then(|v| v.as_bool()) == Some(false) { + data.current = previous.current.clone(); + } + if value.get("nextChanged").and_then(|v| v.as_bool()) == Some(false) { + data.next = previous.next.clone(); + } + } + *target.borrow_mut() = Some(data); + *received.borrow_mut() = js_sys::Date::now(); + ctx.request_repaint(); + } + }); + window.add_event_listener_with_callback("message", listener.as_ref().unchecked_ref()).map_err(error)?; + if let Some(document) = window.document() { + document.set_title("Presenter View — DeckCraft"); + } + let popup = Self { token, origin, opener, snapshot, last_received, listener, view: View::default() }; + send(&popup.opener, &popup.origin, serde_json::json!({"kind":"ready","token":popup.token}))?; + Ok(popup) + } +} +impl eframe::App for Popup { + fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) { + let snapshot = self.snapshot.borrow(); + let notes = snapshot.as_ref().map_or("", |snapshot| snapshot.notes.as_str()); + if !self.view.prepare(ui.ctx(), notes) { + return; + } + ui.ctx().request_repaint_after(std::time::Duration::from_millis(500)); + if self.opener.closed().unwrap_or(true) { + ui.heading("The audience window has closed."); + return; + } + if js_sys::Date::now() - *self.last_received.borrow() > 10_000.0 { + ui.heading("The audience window is not responding."); + ui.label("Return to the audience window to resume the connection."); + return; + } + egui::CentralPanel::default().show(ui, |ui| { + if let Some(snapshot) = snapshot.as_ref() { + for command in self.view.ui(ui, snapshot) { + let _ = send(&self.opener, &self.origin, serde_json::json!({"kind":"command","token":self.token,"command":command})); + } + } else { + ui.label("Waiting for the audience window…"); + } + }); + } +} +impl Drop for Popup { + fn drop(&mut self) { + if let Some(window) = web_sys::window() { + let _ = window.remove_event_listener_with_callback("message", self.listener.as_ref().unchecked_ref()); + } + } +} diff --git a/apps/deckcraft-web/src/web.rs b/apps/deckcraft-web/src/web.rs index f8e68a35c..a385d44c8 100644 --- a/apps/deckcraft-web/src/web.rs +++ b/apps/deckcraft-web/src/web.rs @@ -39,6 +39,10 @@ pub fn start() { log::info!("deckcraft-web {}: wgpu backend {:?}", env!("CARGO_PKG_VERSION"), rs.adapter.get_info().backend); } deckcraft_ui_egui::install_ime_pass_hooks(&cc.egui_ctx); + if let Some(token) = crate::presenter::token() { + let presenter = crate::presenter::Popup::new(token, cc.egui_ctx.clone()).map_err(std::io::Error::other)?; + return Ok(Box::new(presenter) as Box); + } let inbox: Inbox = Inbox::default(); let mut app = SlideApp::new(Session::new(), services(inbox.clone(), cc.egui_ctx.clone())); let q = query(); @@ -80,6 +84,11 @@ impl eframe::App for WebShell { /// Delegate one eframe logic pass to the wrapped application. fn logic(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { self.app.logic(ctx); + if self.app.show.is_none() + && let Some(host) = self.app.services.presenter.as_mut() + { + host.close(); + } } /// Consume browser drops with fresh input, capture the identity before the asynchronous read, @@ -118,7 +127,15 @@ impl eframe::App for WebShell { /// back to `open_async` (browser picker → inbox) and `download`. fn services(inbox: Inbox, ctx: egui::Context) -> Services { let open_inbox = inbox.clone(); + let presenter = match crate::presenter::BrowserHost::new(ctx.clone()) { + Ok(host) => Some(Box::new(host) as Box), + Err(error) => { + log::error!("Presenter window: {error}"); + None + } + }; Services { + presenter, open_async: Some(Box::new(move |purpose: &str, request: u64| { let inbox = open_inbox.clone(); let ctx = ctx.clone(); diff --git a/crates/engine/src/recovery.rs b/crates/engine/src/recovery.rs index 6c5c02308..d8c9f23ef 100644 --- a/crates/engine/src/recovery.rs +++ b/crates/engine/src/recovery.rs @@ -259,6 +259,16 @@ mod tests { dir } + #[test] + fn instance_identity_is_stable_nonzero_and_json_safe() { + let id = instance_id(); + assert_eq!(instance_id(), id); + assert!(id != 0 && id <= UID_MASK); + assert_eq!(id & 0xFF_FFFF, 0); + let encoded = serde_json::to_value(id).unwrap(); + assert_eq!(encoded.as_f64().unwrap() as u64, id); + } + #[test] fn recovers_unsaved_presentations() { let dir = temp("recovery"); diff --git a/crates/pdf/src/tests.rs b/crates/pdf/src/tests.rs index 8bdbbce93..b34e963e1 100644 --- a/crates/pdf/src/tests.rs +++ b/crates/pdf/src/tests.rs @@ -202,7 +202,8 @@ fn unsafe_url_links_are_not_exported() { /// memory. Its naming/shaping tables still parse, but its missing head table prevents PDF /// embedding. No font bytes or vendor assets are stored as test fixtures. fn font_without_head() -> Vec { - let mut bytes = FontDb::global().face("Ubuntu", "Regular").data().to_vec(); + // The final bundled face is always Ubuntu Light; a system lookup may select a variable font. + let mut bytes = deckcraft_fonts::bundled().last().unwrap().to_vec(); for (old, new) in [(b"Ubuntu".as_slice(), b"BadPDF".as_slice()), (b"\0U\0b\0u\0n\0t\0u".as_slice(), b"\0B\0a\0d\0P\0D\0F".as_slice())] { let mut offset = 0; while offset + old.len() <= bytes.len() { diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index b4e531ba4..566dffabe 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -26,6 +26,7 @@ pub mod icons; pub mod media; pub mod menus; pub mod opening; +pub mod presenter; pub mod ribbon; pub mod settings; pub mod show; diff --git a/crates/ui-egui/src/presenter.rs b/crates/ui-egui/src/presenter.rs new file mode 100644 index 000000000..95569778d --- /dev/null +++ b/crates/ui-egui/src/presenter.rs @@ -0,0 +1,450 @@ +//! Bounded presenter-window messages. The audience owns the show; the remote window +//! receives previews and sends input, never a second independently advancing show. +use serde::{Deserialize, Serialize}; + +pub const MAX_PREVIEW_SIDE: usize = 640; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Preview { + pub width: usize, + pub height: usize, + pub rgba: Vec, +} +impl Preview { + pub fn from_image(image: &egui::ColorImage) -> Option { + let [w, h] = image.size; + if w == 0 || h == 0 || w.checked_mul(h)? != image.pixels.len() { + return None; + } + let scale = (MAX_PREVIEW_SIDE as f64 / w.max(h) as f64).min(1.0); + let width = ((w as f64 * scale) as usize).max(1); + let height = ((h as f64 * scale) as usize).max(1); + let mut rgba = Vec::with_capacity(width * height * 4); + for y in 0..height { + for x in 0..width { + let pixel = image.pixels.get((y * h / height) * w + x * w / width)?; + rgba.extend_from_slice(&pixel.to_srgba_unmultiplied()); + } + } + Some(Self { width, height, rgba }) + } + pub fn image(&self) -> Option { + if self.width == 0 + || self.height == 0 + || self.width > MAX_PREVIEW_SIDE + || self.height > MAX_PREVIEW_SIDE + || self.width.checked_mul(self.height)?.checked_mul(4)? != self.rgba.len() + { + return None; + } + Some(egui::ColorImage::from_rgba_unmultiplied([self.width, self.height], &self.rgba)) + } +} +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Snapshot { + pub slide: usize, + pub total: usize, + pub ended: bool, + pub notes: String, + pub elapsed: String, + pub paused: bool, + pub notes_px: f32, + pub blank: Option, + pub grid: bool, + pub zoom_armed: bool, + pub current: Option, + pub next: Option, +} + +/// Images acknowledged by a successful transport send, never merely attempted images. +#[derive(Default)] +pub struct DeltaCache { + current: Option, + next: Option, + token: String, +} +impl DeltaCache { + pub fn send( + &mut self, + mut snapshot: Snapshot, + token: &str, + refresh: bool, + send: impl FnOnce(Snapshot, bool, bool) -> Result<(), E>, + ) -> Result<(), E> { + let fresh = refresh || self.token != token; + let current_changed = fresh || self.current != snapshot.current; + let next_changed = fresh || self.next != snapshot.next; + let current = snapshot.current.clone(); + let next = snapshot.next.clone(); + if !current_changed { + snapshot.current = None; + } + if !next_changed { + snapshot.next = None; + } + send(snapshot, current_changed, next_changed)?; + self.current = current; + self.next = next; + self.token = token.to_owned(); + Ok(()) + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Command { + Key { name: String, command: bool, shift: bool, alt: bool, ctrl: bool }, + Zoom { x: f32, y: f32 }, + End, +} +/// Implemented by the browser host. Native hosts retain the existing egui viewport. +pub trait Host { + fn open(&mut self) -> Result<(), String>; + fn is_open(&self) -> bool; + fn commands(&mut self) -> Vec; + fn update(&mut self, snapshot: Snapshot); + fn close(&mut self); +} + +/// The popup's independent egui renderer. It never advances a local show clock. +#[derive(Default)] +pub struct View { + fonts: crate::uifonts::UiFonts, + styled: bool, + current: Option, + next: Option, + previous_current: Option, + previous_next: Option, +} +impl View { + /// Install the same interface and dynamic fallback fonts as SlideApp before layout. + /// Font definitions take effect on the next pass; never forward input on a discarded pass. + pub fn prepare(&mut self, ctx: &egui::Context, notes: &str) -> bool { + if !self.styled { + crate::theme::install_fonts_with(ctx, &self.fonts.faces); + crate::theme::apply(ctx, &crate::theme::Tokens::dark()); + self.styled = true; + ctx.request_discard("install presenter interface fonts before layout"); + return false; + } + if ctx.will_discard() { + return false; + } + self.fonts.note(ctx, notes); + if self.fonts.apply(ctx) { + ctx.request_discard("install presenter note fallback fonts before layout"); + return false; + } + true + } + + pub fn ui(&mut self, ui: &mut egui::Ui, snapshot: &Snapshot) -> Vec { + if !self.prepare(ui.ctx(), &snapshot.notes) { + return Vec::new(); + } + let mut commands = Vec::new(); + let keys = ui.input(|i| { + i.events + .iter() + .filter_map(|event| if let egui::Event::Key { key, pressed: true, modifiers, .. } = event { Some((*key, *modifiers)) } else { None }) + .collect::>() + }); + for (key, modifiers) in keys { + // Consume once before widgets see Space/Enter, avoiding a second button activation. + ui.input_mut(|i| i.consume_key(modifiers, key)); + commands.push(Command::Key { + name: key.name().into(), + command: modifiers.command, + shift: modifiers.shift, + alt: modifiers.alt, + ctrl: modifiers.ctrl, + }); + } + fn update( + ctx: &egui::Context, + name: &str, + previous: &mut Option, + texture: &mut Option, + image: &Option, + ) { + if previous == image { + return; + } + *previous = image.clone(); + *texture = image.as_ref().and_then(Preview::image).map(|image| ctx.load_texture(name, image, egui::TextureOptions::LINEAR)); + } + update(ui.ctx(), "remote-current", &mut self.previous_current, &mut self.current, &snapshot.current); + update(ui.ctx(), "remote-next", &mut self.previous_next, &mut self.next, &snapshot.next); + let key = |name: &str| Command::Key { name: name.into(), command: false, shift: false, alt: false, ctrl: false }; + ui.horizontal_wrapped(|ui| { + ui.heading(&snapshot.elapsed); + ui.label(format!("Slide {} of {}", snapshot.slide.saturating_add(1), snapshot.total)); + for (label, name) in [("◀ Previous", "ArrowLeft"), ("Next ▶", "ArrowRight")] { + if ui.button(label).clicked() { + commands.push(key(name)); + } + } + if ui.button("End Show").clicked() { + commands.push(Command::End); + } + }); + ui.horizontal_wrapped(|ui| { + for (label, name) in [ + (if snapshot.paused { "Resume" } else { "Pause" }, "T"), + ("Reset", "R"), + ("Black", "B"), + ("White", "W"), + ("All slides", "G"), + ("Zoom", "Z"), + ] { + if ui.button(label).clicked() { + commands.push(key(name)); + } + } + }); + ui.separator(); + ui.columns(2, |columns| { + let left = &mut columns[0]; + if snapshot.ended { + left.heading("End of slide show"); + } else if let Some(texture) = &self.current { + let response = left.add( + egui::Image::new(texture) + .fit_to_exact_size(fit_preview(texture.size_vec2(), left.available_width(), left.available_height() * 0.8)) + .sense(egui::Sense::click()), + ); + if let Some(blank) = &snapshot.blank { + let color = if blank == "white" { egui::Color32::WHITE } else { egui::Color32::BLACK }; + left.painter().rect_filled(response.rect, 0.0, color); + } + if snapshot.zoom_armed + && response.clicked() + && let Some(point) = response.interact_pointer_pos() + { + commands.push(Command::Zoom { + x: (point.x - response.rect.left()) / response.rect.width().max(1.0), + y: (point.y - response.rect.top()) / response.rect.height().max(1.0), + }); + } + } + if snapshot.zoom_armed { + left.label("Click the preview to zoom."); + } + if snapshot.grid { + left.label("Choose a slide in the audience window, or press G to return."); + } + let right = &mut columns[1]; + right.label("Next"); + if let Some(texture) = &self.next { + right.add(egui::Image::new(texture).fit_to_exact_size(fit_preview( + texture.size_vec2(), + right.available_width(), + right.available_height() * 0.45, + ))); + } else { + right.label("End of slide show"); + } + right.horizontal(|ui| { + ui.label("Notes"); + if ui.button("A−").clicked() { + commands.push(key(egui::Key::OpenBracket.name())); + } + if ui.button("A+").clicked() { + commands.push(key(egui::Key::CloseBracket.name())); + } + }); + egui::ScrollArea::vertical().show(right, |ui| { + ui.label( + egui::RichText::new(if snapshot.notes.is_empty() { "No notes." } else { &snapshot.notes }) + .size(snapshot.notes_px.clamp(10.0, 72.0)), + ); + }); + }); + commands + } +} +fn fit_preview(size: egui::Vec2, width: f32, height: f32) -> egui::Vec2 { + size * (width.max(1.0) / size.x.max(1.0)).min(height.max(1.0) / size.y.max(1.0)) +} + +#[cfg(test)] +mod tests { + use super::*; + + fn snapshot() -> Snapshot { + Snapshot { + slide: 0, + total: 2, + ended: false, + notes: String::new(), + elapsed: "00:00:00".into(), + paused: false, + notes_px: 18.0, + blank: None, + grid: false, + zoom_armed: false, + current: Some(Preview { width: 1, height: 1, rgba: vec![255; 4] }), + next: Some(Preview { width: 1, height: 1, rgba: vec![0; 4] }), + } + } + + #[test] + fn failed_transport_retries_images_and_only_success_deduplicates() { + let mut cache = DeltaCache::default(); + let first = snapshot(); + let failed = cache.send(first.clone(), "session", false, |delta, current, next| { + assert!(current && next); + assert_eq!(delta.current, first.current); + assert_eq!(delta.next, first.next); + Err("serialization or postMessage failed") + }); + assert!(failed.is_err()); + let sent = cache.send(first.clone(), "session", false, |delta, current, next| { + assert!(current && next, "a failed initial send must not suppress either image"); + assert_eq!(delta.current, first.current); + assert_eq!(delta.next, first.next); + Ok::<_, ()>(()) + }); + assert!(sent.is_ok()); + let sent = cache.send(first.clone(), "session", false, |delta, current, next| { + assert!(!current && !next); + assert!(delta.current.is_none() && delta.next.is_none()); + Ok::<_, ()>(()) + }); + assert!(sent.is_ok()); + let mut changed = first.clone(); + changed.current.as_mut().unwrap().rgba = vec![42; 4]; + let failed = cache.send(changed.clone(), "session", false, |_, current, next| { + assert!(current && !next); + Err(()) + }); + assert!(failed.is_err()); + let sent = cache.send(changed.clone(), "session", false, |delta, current, next| { + assert!(current && !next, "unchanged retry after a failed changed-image send"); + assert_eq!(delta.current, changed.current); + Ok::<_, ()>(()) + }); + assert!(sent.is_ok()); + } + + #[test] + fn transport_refreshes_new_sessions_reloads_and_clears_previews() { + let mut cache = DeltaCache::default(); + for (token, refresh) in [("first", false), ("second", false), ("second", true)] { + let sent = cache.send(snapshot(), token, refresh, |delta, current, next| { + assert!(current && next); + assert!(delta.current.is_some() && delta.next.is_some()); + Ok::<_, ()>(()) + }); + assert!(sent.is_ok()); + } + let failed = cache.send(snapshot(), "second", true, |_, current, next| { + assert!(current && next); + Err(()) + }); + // BrowserHost retains refresh_images after failure, even when the token is unchanged. + let refresh_images = failed.is_err(); + let sent = cache.send(snapshot(), "second", refresh_images, |_, current, next| { + assert!(current && next, "reload refresh must survive a failed send"); + Ok::<_, ()>(()) + }); + assert!(sent.is_ok()); + let mut cleared = snapshot(); + cleared.current = None; + cleared.next = None; + let failed = cache.send(cleared.clone(), "second", false, |_, current, next| { + assert!(current && next); + Err(()) + }); + assert!(failed.is_err()); + let sent = cache.send(cleared.clone(), "second", false, |delta, current, next| { + assert!(current && next, "clearing images is retried too"); + assert!(delta.current.is_none() && delta.next.is_none()); + Ok::<_, ()>(()) + }); + assert!(sent.is_ok()); + let sent = cache.send(cleared, "second", false, |_, current, next| { + assert!(!current && !next); + Ok::<_, ()>(()) + }); + assert!(sent.is_ok()); + } + + #[test] + fn popup_installs_interface_fonts_before_non_latin_note_layout() { + let ctx = egui::Context::default(); + let mut view = View::default(); + let mut data = snapshot(); + let arabic = "\u{645}\u{631}\u{62d}\u{628}\u{627}"; + let japanese = "\u{65e5}\u{672c}\u{8a9e}"; + let korean = "\u{d55c}\u{ae00}"; + data.notes = format!("{arabic} {japanese} {korean}"); + let mut installing = 0; + let mut layouts = 0; + for _ in 0..4 { + let mut output = ctx.run_ui(egui::RawInput::default(), |ui| { + if !view.prepare(ui.ctx(), &data.notes) { + installing += 1; + assert!(view.ui(ui, &data).is_empty(), "no commands during a discarded font-install pass"); + return; + } + assert!(!ui.ctx().will_discard()); + layouts += 1; + for (family, text) in [("Noto Sans Arabic", arabic), ("BIZ UDPGothic", japanese), ("NanumGothic", korean)] { + if deckcraft_fonts::CRAFT_FONTS.iter().any(|face| face.family == family) { + ui.ctx().fonts_mut(|fonts| { + for c in text.chars() { + assert!(fonts.has_glyph(&egui::FontId::proportional(18.0), c), "missing bundled {family} glyph {c:?}"); + } + }); + } + } + let _ = view.ui(ui, &data); + }); + output.textures_delta.clear(); + } + assert!(installing > 0 && layouts > 0, "font installation must precede an actual notes layout"); + } + #[test] + fn popup_input_is_forwarded_once_without_advancing_its_own_state() { + use egui_kittest::kittest::Queryable; + let snapshot = Snapshot { + slide: 0, + total: 3, + ended: false, + notes: "Synthetic notes".into(), + elapsed: "00:00:00".into(), + paused: false, + notes_px: 18.0, + blank: None, + grid: false, + zoom_armed: false, + current: None, + next: None, + }; + let mut h = egui_kittest::Harness::builder().with_size(egui::vec2(1000.0, 700.0)).build_ui_state( + |ui, (view, snapshot, sent): &mut (View, Snapshot, Vec)| { + sent.extend(view.ui(ui, snapshot)); + }, + (View::default(), snapshot, Vec::new()), + ); + h.run_steps(2); + h.get_by_label("Next ▶").click(); + h.run_steps(2); + assert_eq!(h.state().2.len(), 1); + h.key_press(egui::Key::Space); + h.run_steps(2); + assert_eq!(h.state().2.len(), 2, "Space must not also activate the focused Next button"); + assert_eq!(h.state().0.previous_current, None); + assert_eq!(h.state().1.slide, 0, "only an audience snapshot changes the displayed position"); + assert!(matches!(h.state().2.last(), Some(Command::Key { name, .. }) if name == egui::Key::Space.name())); + } + + #[test] + fn previews_are_bounded_and_bad_dimensions_are_rejected() { + let image = egui::ColorImage::filled([1280, 720], egui::Color32::RED); + let p = Preview::from_image(&image).unwrap(); + assert_eq!((p.width, p.height), (640, 360)); + assert_eq!(p.image().unwrap().pixels[0], egui::Color32::RED); + for (width, height, rgba) in [(usize::MAX, 1, vec![]), (0, 1, vec![]), (1, 1, vec![0; 3]), (641, 1, vec![0; 2564])] { + assert!(Preview { width, height, rgba }.image().is_none()); + } + } +} diff --git a/crates/ui-egui/src/services.rs b/crates/ui-egui/src/services.rs index 88f03ac2c..fc8eb5d96 100644 --- a/crates/ui-egui/src/services.rs +++ b/crates/ui-egui/src/services.rs @@ -36,6 +36,8 @@ pub type Inbox = std::sync::Arc>>; /// Platform services injected by the host (desktop or web). #[derive(Default)] pub struct Services { + /// Browser-owned presenter popup; absent on native hosts. + pub presenter: Option>, /// Open-file dialog for a purpose (`open`, `picture`, `audio`, `video`) → path. pub pick_open: Option, /// Save dialog with a suggested name → path. diff --git a/crates/ui-egui/src/show.rs b/crates/ui-egui/src/show.rs index 1896e3be7..a8521d3d8 100644 --- a/crates/ui-egui/src/show.rs +++ b/crates/ui-egui/src/show.rs @@ -63,6 +63,10 @@ pub struct Show { /// Preview renders started on another thread. #[cfg(test)] preview_spawns: usize, + remote_preview: Option, + remote_next: Option<(usize, crate::presenter::Preview)>, + remote_sent: f64, + remote_opened: bool, /// The next slide's first frame, rendered in the background while this one is shown so /// advancing only uploads it (#240). prefetch: Option, @@ -231,6 +235,10 @@ impl Show { next_job: None, #[cfg(test)] preview_spawns: 0, + remote_preview: None, + remote_next: None, + remote_sent: f64::NEG_INFINITY, + remote_opened: false, prefetch: None, backdrop: None, blank: None, diff --git a/crates/ui-egui/src/show/keys.rs b/crates/ui-egui/src/show/keys.rs index c7da76e2c..77741866d 100644 --- a/crates/ui-egui/src/show/keys.rs +++ b/crates/ui-egui/src/show/keys.rs @@ -12,6 +12,22 @@ pub(super) fn keyboard(ctx: &egui::Context, show: &mut Show, doc: &Presentation, .filter_map(|e| if let egui::Event::Key { key, pressed: true, modifiers, .. } = e { Some((*key, *modifiers)) } else { None }) .collect() }); + let (keep, consumed) = handle_keys(show, doc, now, keys, presenter); + for (key, modifiers) in consumed { + ctx.input_mut(|i| i.consume_key(modifiers, key)); + ctx.request_repaint_of(egui::ViewportId::ROOT); + } + keep +} + +pub(super) fn handle_keys( + show: &mut Show, + doc: &Presentation, + now: f64, + keys: Vec<(egui::Key, egui::Modifiers)>, + presenter: bool, +) -> (bool, Vec<(egui::Key, egui::Modifiers)>) { + let mut consumed = vec![]; let mut keep = true; let mut actions = vec![]; for (k, m) in keys { @@ -31,15 +47,14 @@ pub(super) fn keyboard(ctx: &egui::Context, show: &mut Show, doc: &Presentation, } // The same key must not also activate a focused presenter button or be handled again // by an embedded presenter viewport. - ctx.input_mut(|i| i.consume_key(m, k)); - ctx.request_repaint_of(egui::ViewportId::ROOT); + consumed.push((k, m)); } for action in actions { if !show.apply(action, doc, now) { keep = false; } } - keep + (keep, consumed) } /// Whether the grid that the presenter key G opens is showing in this viewport. diff --git a/crates/ui-egui/src/show/tests.rs b/crates/ui-egui/src/show/tests.rs index a1069a5bb..23909fe41 100644 --- a/crates/ui-egui/src/show/tests.rs +++ b/crates/ui-egui/src/show/tests.rs @@ -1123,6 +1123,66 @@ fn input_state_tracks_the_modes_that_move_show_click_targets() { assert_ne!(show.input_state(), base, "a blank screen has no slide click targets"); } +#[test] +fn remote_presenter_uses_the_audience_state_and_closes_with_the_show() { + use crate::presenter::{Command, Host, Snapshot}; + use std::{cell::RefCell, rc::Rc}; + #[derive(Default)] + struct Bridge { + opens: usize, + closes: usize, + commands: Vec, + } + struct Mock(Rc>); + impl Host for Mock { + fn open(&mut self) -> Result<(), String> { + self.0.borrow_mut().opens += 1; + Ok(()) + } + fn is_open(&self) -> bool { + true + } + fn commands(&mut self) -> Vec { + std::mem::take(&mut self.0.borrow_mut().commands) + } + fn update(&mut self, _: Snapshot) {} + fn close(&mut self) { + self.0.borrow_mut().closes += 1; + } + } + let bridge = Rc::new(RefCell::new(Bridge::default())); + let mut session = deckcraft_engine::Session::with_new(); + session.execute("slide.new", &json!({})).unwrap(); + session.execute("slide.new", &json!({})).unwrap(); + let services = crate::Services { presenter: Some(Box::new(Mock(bridge.clone()))), ..Default::default() }; + let mut app = SlideApp::new(session, services); + app.ui.presenter_view = true; + let mut h = egui_kittest::Harness::builder().with_size(vec2(1000.0, 700.0)).build_ui_state( + |ui, app: &mut SlideApp| { + app.logic(ui.ctx()); + app.ui(ui); + }, + app, + ); + h.run_steps(3); + h.state_mut().start_show(0, false); + h.run_steps(2); + assert_eq!(bridge.borrow().opens, 1); + for (key, slide) in [(egui::Key::ArrowRight, 1), (egui::Key::ArrowLeft, 0), (egui::Key::End, 2), (egui::Key::Home, 0)] { + bridge.borrow_mut().commands.push(Command::Key { name: key.name().into(), command: false, shift: false, alt: false, ctrl: false }); + h.run_steps(2); + assert_eq!(h.state().show.as_ref().unwrap().state.slide, slide); + } + bridge.borrow_mut().commands.push(Command::End); + h.run_steps(2); + assert!(h.state().show.is_none()); + assert_eq!(bridge.borrow().closes, 1); + h.state_mut().start_show(1, false); + h.run_steps(2); + assert_eq!(bridge.borrow().opens, 2); + assert_eq!(h.state().show.as_ref().unwrap().state.slide, 1); +} + /// #964: the next-slide preview renders on another thread; the presenter frame that asks for /// it doesn't wait, and the preview arrives on a later frame. #[test] diff --git a/crates/ui-egui/src/show/ui.rs b/crates/ui-egui/src/show/ui.rs index 71107f94f..a0a1fe29a 100644 --- a/crates/ui-egui/src/show/ui.rs +++ b/crates/ui-egui/src/show/ui.rs @@ -1,8 +1,8 @@ -use super::keys::keyboard; +use super::keys::{handle_keys, keyboard}; use super::media::{ Pick, Under, gif_hit, media_bar_target, media_hit, on_screen, pointer_on_media_bar, run_media_cues, shapes_under_pointer, show_media, }; -use super::presenter::{PresenterTimer, presenter_window}; +use super::presenter::{PresenterTimer, format_elapsed, presenter_window}; use super::render::{below_playing_video, fit, part_textures, quad_mesh, render_frame, render_overlay, render_threads, start_prefetch}; use super::zoom::{ Zoom, grid_indices, norm_on_slide, paint_grid, see_all_hit, slide_aspect, slide_box, slide_to_screen, toggle_blank, tool_bar_rect, unit_uv, @@ -58,6 +58,9 @@ pub fn ui(app: &mut SlideApp, ui: &mut Ui) { let ctx = ui.ctx().clone(); let Some((doc_uid, doc)) = app.session.active().map(|d| (d.uid, d.doc.clone())) else { app.show = None; + if let Some(host) = app.services.presenter.as_mut() { + host.close(); + } return; }; let now = ctx.input(|i| i.time); @@ -71,8 +74,35 @@ pub fn ui(app: &mut SlideApp, ui: &mut Ui) { return; } show.observe_visible_frame(now, web_time::Instant::now()); - begin_show(&ctx, &mut show, &doc, now); + begin_show(&ctx, &mut show, &doc, now, app.services.presenter.is_some()); let mut out = Out { keep: keyboard(&ctx, &mut show, &doc, now, false), actions: vec![] }; + if show.presenter + && !show.reading + && let Some(host) = app.services.presenter.as_mut() + { + if !show.remote_opened { + show.remote_opened = true; + if let Err(message) = host.open() { + app.status = Some((message, crate::now_ms())); + } + } + for command in host.commands() { + match command { + crate::presenter::Command::End => out.keep = false, + crate::presenter::Command::Zoom { x, y } if x.is_finite() && y.is_finite() && show.zoom_arm => { + show.zoom = Some(Zoom::at(x.clamp(0.0, 1.0), y.clamp(0.0, 1.0))); + show.zoom_arm = false; + } + crate::presenter::Command::Key { name, command, shift, alt, ctrl } => { + if let Some(key) = egui::Key::ALL.iter().copied().find(|key| key.name() == name) { + let modifiers = egui::Modifiers { command, shift, alt, ctrl, mac_cmd: command && !ctrl }; + out.keep &= handle_keys(&mut show, &doc, now, vec![(key, modifiers)], false).0; + } + } + _ => {} + } + } + } let (clicked, secondary, moved) = ctx.input(|i| (i.pointer.primary_clicked(), i.pointer.secondary_clicked(), i.pointer.delta().length() > 0.0)); if moved { show.last_move = now; @@ -94,6 +124,43 @@ pub fn ui(app: &mut SlideApp, ui: &mut Ui) { draw_pen_and_hints(ui, &mut show, &f, &painter, pointing); draw_bars(ui, &mut show, &f, &painter, &mut out); draw_extras(&mut show, &f, &painter, &mut out); + if out.keep + && show.presenter + && !show.reading + && let Some(host) = app.services.presenter.as_mut() + { + if now - show.remote_sent >= 0.2 { + let next = show.state.peek_next(&doc); + if let Some(n) = next + && show.remote_next.as_ref().is_none_or(|(old, _)| *old != n) + { + let size = + crate::textures::fit_size((480, (480.0 * doc.slide_size.height / doc.slide_size.width.max(1.0)).clamp(1.0, 1e9) as u32), 640); + let image = deckcraft_render::render_slide( + &doc, + n, + &RenderOpts { scale: size.0 as f64 / doc.slide_size.width.max(1.0), size: Some(size), ..Default::default() }, + ); + show.remote_next = crate::presenter::Preview::from_image(&crate::textures::to_color_image(&image, false)).map(|image| (n, image)); + } + host.update(crate::presenter::Snapshot { + slide: show.state.slide, + total: doc.slides.len(), + ended: show.ended, + notes: doc.slides.get(show.state.slide).map(|s| s.notes_text()).unwrap_or_default(), + elapsed: format_elapsed(show.timer.elapsed(now)), + paused: show.timer.paused(), + notes_px: show.notes_px, + blank: show.blank_name().map(str::to_owned), + grid: show.grid, + zoom_armed: show.zoom_arm, + current: show.remote_preview.clone(), + next: show.remote_next.as_ref().filter(|(n, _)| Some(*n) == next).map(|(_, image)| image.clone()), + }); + show.remote_sent = now; + } + ctx.request_repaint_after(std::time::Duration::from_millis(200)); + } finish(app, show, &f, out.keep); } @@ -110,7 +177,7 @@ fn paint_hidden(ui: &Ui, doc: &Presentation, show: &Show) { } } -fn begin_show(ctx: &egui::Context, show: &mut Show, doc: &Presentation, now: f64) { +fn begin_show(ctx: &egui::Context, show: &mut Show, doc: &Presentation, now: f64, remote: bool) { if !show.started { show.started = true; show.slide_start = now; @@ -121,7 +188,7 @@ fn begin_show(ctx: &egui::Context, show: &mut Show, doc: &Presentation, now: f64 show.show_start = now; show.timer = PresenterTimer::start(now); show.last_move = now; - if show_fills_screen(show.reading, &doc.show.show_type) { + if show_fills_screen(show.reading, &doc.show.show_type) && !(show.presenter && remote) { ctx.send_viewport_cmd(egui::ViewportCommand::Fullscreen(true)); } show.after_enter(doc, now); @@ -303,6 +370,9 @@ fn frame_texture(show: &mut Show, f: &Fr, sl: &Sl) -> Option { render_frame(doc, idx, tl, step, sl.t, size, sl.hidden.clone(), &sl.times, render_threads(), &sl.plays, &sl.stamps, back.as_deref()) } }; + if show.remote_opened && show.presenter { + show.remote_preview = crate::presenter::Preview::from_image(&ci); + } let tex = match show.tex.take() { Some((_, mut h)) => { crate::textures::replace(ctx, &mut h, ci); @@ -730,7 +800,7 @@ fn draw_extras(show: &mut Show, f: &Fr, painter: &egui::Painter, out: &mut Out) ctx.request_repaint_after(std::time::Duration::from_millis(100)); } // Presenter view in a second window. - if out.keep && show.presenter && !show.reading { + if out.keep && show.presenter && !show.reading && !show.remote_opened { presenter_window(ctx, show, doc, now, &mut out.keep); } } @@ -740,6 +810,9 @@ fn finish(app: &mut SlideApp, mut show: Show, f: &Fr, keep: bool) { if keep { app.show = Some(show); } else { + if let Some(host) = app.services.presenter.as_mut() { + host.close(); + } app.media.stop_owned(crate::media::Owner::Show); if !show.reading { ctx.send_viewport_cmd(egui::ViewportCommand::Fullscreen(false)); diff --git a/docs/wasm-presenter-popout-729.md b/docs/wasm-presenter-popout-729.md new file mode 100644 index 000000000..0ee3f4979 --- /dev/null +++ b/docs/wasm-presenter-popout-729.md @@ -0,0 +1,65 @@ +# WASM presenter-view popout (#729) + +Tracks https://github.com/storytold/deckcraft/issues/729 (the reporter moved duplicate #726 here). + +## Implementation + +The browser presenter opens the same DeckCraft web build in a separate, same-origin window. +That window starts its own eframe runner and renders only presenter controls, current/next +previews and notes. The audience window remains the sole owner of slideshow state, animations, +media and navigation. Presenter keyboard input uses the same navigation handler as the native +presenter, so an input is applied once rather than advancing two independent shows. + +Messages check the exact origin, source window and a per-opening session identifier. Input +queues and preview dimensions are bounded. Previews use the audience's rendered current frame; +unchanged preview pixels are not retransmitted. Presenter updates are limited to five per second. + +If the browser blocks the initial popup, an explicit Open presenter window button calls the +browser API directly from its click handler. Browser policy can still require the user to allow +popups, or choose to open a tab instead of a window. Closing the presenter leaves the audience +running and offers the same button to reopen it. Ending the show closes the presenter. The +presenter reports a closed or unresponsive audience rather than continuing an independent show. +Native presenter view continues to use its existing egui viewport. + +No native second-display placement, Linux display-counting policy, laser/rehearsal changes or +other contributors' unmerged presenter work is included. + +## Validation + +Candidate implementation; not yet qualified for release. The current-main reconciliation and +transport/font corrections have had source inspection and static diff checks only. No local Rust +builds, tests or formatter were run for this candidate; hosted compilation and regression tests +remain pending. Earlier-head validation recorded in the PR does not qualify this changed tree. +The original bug was reproduced on the deployed 0.7.0 browser build on 2026-10-14; that +deployment's exact commit is unknown. + +Regression coverage submitted for hosted execution checks successful image deduplication, +failed-send retries, session/reload refresh and clearing previews. The independent popup uses +the existing interface font definitions and UiFonts fallback discovery before laying out notes, +discarding font-install passes before input forwarding. Its font regression checks bundled +Arabic/Japanese/Hangul glyphs when those optional font inputs are present; missing optional +inputs do not establish script coverage. + +Source inspection verifies these lifecycle paths: a blocked popup offers an explicit retry +whose click handler calls the browser API; closing the popup offers reopening; ending the show +closes the popup; incoming messages check origin, source window and opening-session token. +This establishes the intended control flow, not empirical compatibility with each browser. + +Runtime checks that would add empirical coverage with a synthetic deck: + +- Popup allowed and blocked, explicit retry, and independent window positioning. +- Initial popup behavior in Safari and Firefox, including whether explicit retry is needed on + each show start. These browser families have not been exercised for this candidate; missing + manual coverage alone is not evidence of a defect or a mandatory merge blocker. +- Next/Previous, Home/End, numeric navigation, and no double advance on Space/Enter. +- Current/next previews, notes, pause/reset, black/white screens, All Slides and zoom. +- Navigation from both windows, including animation steps and the end screen. +- Close/reopen the presenter, reload it, end/restart the show, and close/reload the audience. +- Rejection of messages from the wrong origin, source window or prior session. +- Native presenter regressions, WASM compilation and the full repository quality gates. + +All runtime items above, including actual browser popup/reload/end-show execution, remain +unexecuted for this candidate. Shared native tests and source inspection do not constitute +browser-executed validation. Font subsets can legitimately omit individual script families; +the regression always checks installation/layout/discard handling, and checks a script's glyphs +only when its corresponding bundled face is present. From cc00a17dfe04194d9952d41b5e052efc634c1cda Mon Sep 17 00:00:00 2001 From: Simon Koch-Sultan <126534658+scks1@users.noreply.github.com> Date: Sun, 1 Nov 2026 15:52:54 -0500 Subject: [PATCH 067/716] #1596: let effect-hole QA images overwrite an earlier run's Co-Authored-By: Claude Opus 5.5 --- crates/render/src/tests_effect_holes.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/render/src/tests_effect_holes.rs b/crates/render/src/tests_effect_holes.rs index 10749229d..fdddf60fd 100644 --- a/crates/render/src/tests_effect_holes.rs +++ b/crates/render/src/tests_effect_holes.rs @@ -64,11 +64,9 @@ fn draw(shape: &str, effect: Effect) -> Image { let p = scene(shape, effect); let image = render_slide(&p, 0, &RenderOpts { scale: 1.0, ..Default::default() }); if let Ok(dir) = std::env::var("DECKCRAFT_EFFECT_HOLES_QA") { - use std::io::Write as _; + // Overwrite, so a QA directory can be reused across runs. std::fs::create_dir_all(&dir).unwrap(); - let path = std::path::Path::new(&dir).join(format!("{shape}-{effect:?}.png")); - let mut file = std::fs::OpenOptions::new().write(true).create_new(true).open(path).unwrap(); - file.write_all(&image.to_png()).unwrap(); + std::fs::write(std::path::Path::new(&dir).join(format!("{shape}-{effect:?}.png")), image.to_png()).unwrap(); } image } From cbb0c484459af252620ef0ad9c928cde586290a0 Mon Sep 17 00:00:00 2001 From: Stephan Schott-Verdugo Date: Sun, 1 Nov 2026 22:19:06 +0100 Subject: [PATCH 068/716] Fix OS clipboard: enable eframe's clipboard feature dropped in the egui 0.37 migration Since #1350 (v0.11.1) the desktop build listed eframe features without `clipboard`, so egui-winit simulated a clipboard inside the app: Ctrl+V never read text or pictures from other apps, and Ctrl+C of text (sent out as HTML through arboard) never reached egui's clipboard, so Ctrl+V pasted nothing or stale text. The context menu kept working because it only uses the session clipboard. Turn the feature back on. On native Wayland, egui-winit owns the clipboard through winit's data device (text and PNG); leave the X11-only arboard pasteboard (HTML, pictures) off there so copies are claimed on the Wayland selection. Regression tests guard the feature list and the Wayland switch. Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 102 +++++++++++++++++++++++++++++++++++-- ROADMAP.md | 4 +- apps/deckcraft/Cargo.toml | 4 +- apps/deckcraft/src/main.rs | 41 +++++++++++++-- docs/gaps.md | 5 +- docs/parity-checklist.md | 4 +- 6 files changed, 144 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 408e99948..2e7f72a5f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -565,18 +565,42 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "calloop" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e" +dependencies = [ + "bitflags 2.13.2", + "polling", + "rustix 1.1.5", + "tracing", +] + [[package]] name = "calloop-wayland-source" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" dependencies = [ - "calloop", + "calloop 0.13.0", "rustix 0.38.44", "wayland-backend", "wayland-client", ] +[[package]] +name = "calloop-wayland-source" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" +dependencies = [ + "calloop 0.14.5", + "rustix 1.1.5", + "wayland-backend", + "wayland-client", +] + [[package]] name = "cast" version = "0.3.0" @@ -1507,13 +1531,16 @@ dependencies = [ "block2 0.6.2", "bytemuck", "egui", + "image", "log", "objc2 0.6.5", "objc2-app-kit 0.3.2", "objc2-foundation 0.3.2", "objc2-ui-kit 0.3.2", + "parking_lot", "profiling", "raw-window-handle", + "smithay-clipboard", "web-time", "webbrowser", "windows-sys 0.61.2", @@ -4403,8 +4430,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" dependencies = [ "bitflags 2.13.2", - "calloop", - "calloop-wayland-source", + "calloop 0.13.0", + "calloop-wayland-source 0.3.0", "cursor-icon", "libc", "log", @@ -4421,6 +4448,44 @@ dependencies = [ "xkeysym", ] +[[package]] +name = "smithay-client-toolkit" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0" +dependencies = [ + "bitflags 2.13.2", + "calloop 0.14.5", + "calloop-wayland-source 0.4.1", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix 1.1.5", + "thiserror 2.0.21", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-experimental", + "wayland-protocols-misc", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + +[[package]] +name = "smithay-clipboard" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226" +dependencies = [ + "libc", + "smithay-client-toolkit 0.20.0", + "wayland-backend", +] + [[package]] name = "smol_str" version = "0.2.2" @@ -4928,6 +4993,7 @@ version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -5370,6 +5436,32 @@ dependencies = [ "wayland-scanner", ] +[[package]] +name = "wayland-protocols-experimental" +version = "20250721.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-misc" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + [[package]] name = "wayland-protocols-plasma" version = "0.3.12" @@ -5980,7 +6072,7 @@ dependencies = [ "bitflags 2.13.2", "block2 0.5.1", "bytemuck", - "calloop", + "calloop 0.13.0", "cfg_aliases", "concurrent-queue", "core-foundation 0.9.4", @@ -6001,7 +6093,7 @@ dependencies = [ "raw-window-handle", "redox_syscall 0.4.1", "rustix 0.38.44", - "smithay-client-toolkit", + "smithay-client-toolkit 0.19.2", "smol_str", "tracing", "unicode-segmentation", diff --git a/ROADMAP.md b/ROADMAP.md index f92554c14..6255c9421 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,7 +2,7 @@ **Stage: alpha** · next: beta, ~20 points and ~120–210 h away -> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-30 · **Change:** trivial (print-preview tests use egui's emitted URL, and macOS removes its previews before exit; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) +> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-11-01 · **Change:** major (fix for a workflow-breaking regression: Ctrl+C/X/V use the system clipboard again, broken for all text and objects from 0.11.1 to 0.14.1; stage and scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-30 · **Change:** trivial (progress log: read-only `slide.actions` lists shape and table text actions; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-27 · **Change:** trivial (progress log: Set Up Slide Show ▸ Keep mouse cursor visible, #1445; stage and scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-26 · **Change:** trivial (progress log: dragging several selected slides moves them all; previous: trivial, progress log: Edit Points handle drags with Shift, Ctrl/Cmd or Alt/Option set the point type; previous: trivial, progress log: scroll bars on the zoomed slide pane, #1157; previous: minor, native chart payloads stored in bounded ZIP members; previous: major, community PR wave 2026-10-14: ~60 landed items in the progress log, among them the Font, Paragraph, Photo Album, theme colour and font and Date and Time dialogs, presenter and show controls, the SmartArt Text Pane and PPTX corpus slices; breadth 84% after `cargo xtask parity`, ready stays ~55%, stage stays alpha; duplicated rows and headers folded; previous: minor, hours to ~95% per audience added) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) @@ -148,6 +148,7 @@ app's JSON control channel (`deckcraft --control PORT`). | Date | What landed | |---|---| +| 2026-11-01 | Clipboard: Ctrl+C, Ctrl+X and Ctrl+V use the system clipboard again, so text and pictures paste from other apps and in-app copies paste back. Since the egui 0.37 migration (#1350) the desktop build had a clipboard that only worked inside the app. On native Wayland, text goes through egui's Wayland clipboard; HTML stays on X11, macOS and Windows | | 2026-10-30 | Print-preview tests use the URL emitted by egui and its exact file path; previews are explicitly removed before the macOS process exits | | 2026-10-30 | `slide.actions` lists shape click and hover actions and text-run hyperlinks (including table cells and grouped shapes) for audit; listing never runs an action. The UI pane is a follow-up | | 2026-10-29 | Slide Show: going back to the previous slide plays the transition of the slide being left, reversed, as PowerPoint does, instead of the previous slide's own entrance transition (#1531); a jump (Go to Slide, links) still plays the target slide's transition | @@ -318,6 +319,7 @@ app's JSON control channel (`deckcraft --control PORT`). | Date | Change | Summary | |---|---|---| +| 2026-11-01 | major | Workflow-breaking regression fixed: the desktop build uses the system clipboard again (eframe `clipboard` feature) | | 2026-10-30 | trivial | Progress log: read-only slide action inspection; parity scores unchanged | | 2026-10-29 | trivial | Progress log: going back in the slide show reverses the left slide's transition (#1531). Scores and milestone names unchanged | | 2026-10-29 | trivial | Progress log: the Picture Styles row leaves room for Crop and Size (#1232). Scores and milestone names unchanged | diff --git a/apps/deckcraft/Cargo.toml b/apps/deckcraft/Cargo.toml index b336a8433..5b4afbb83 100644 --- a/apps/deckcraft/Cargo.toml +++ b/apps/deckcraft/Cargo.toml @@ -14,7 +14,9 @@ workspace = true deckcraft-engine = { workspace = true } deckcraft-ui-egui = { workspace = true } deckcraft-media = { workspace = true } -eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit", "links", "wayland", "x11"] } +# `clipboard` is the OS clipboard (Ctrl+C/X/V with other apps). Without it egui simulates one inside +# the app; the egui 0.37 migration (#1350) dropped it from this list. +eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit", "clipboard", "links", "wayland", "x11"] } egui = { workspace = true } serde_json = { workspace = true } log = { workspace = true } diff --git a/apps/deckcraft/src/main.rs b/apps/deckcraft/src/main.rs index ad3f820fa..2798c2d71 100644 --- a/apps/deckcraft/src/main.rs +++ b/apps/deckcraft/src/main.rs @@ -103,7 +103,13 @@ fn save_prefs(app: &SlideApp) { } } -fn services() -> Services { +/// The desktop services. `native_wayland`: the window is a Wayland client (not Xwayland). +fn services(native_wayland: bool) -> Services { + // On native Wayland, egui-winit owns the clipboard through winit's data device, which carries + // text and PNG but no HTML. `pasteboard` (arboard, built for X11 only) would put a copy on the + // Xwayland selection instead and skip egui's Wayland claim, so Ctrl+V would read something + // else. There, text goes through egui and pictures arrive as `PasteImage` events. + let pasteboard = !native_wayland; Services { pick_open: Some(Box::new(|purpose: &str| { let d = rfd::FileDialog::new(); @@ -126,9 +132,9 @@ fn services() -> Services { pick_save: Some(Box::new(|name: &str| rfd::FileDialog::new().set_file_name(name).save_file().map(|p| p.to_string_lossy().to_string()))), read: Some(Box::new(|p: &str| std::fs::read(p).map_err(|e| e.to_string()))), write: Some(Box::new(|p: &str, b: &[u8]| std::fs::write(p, b).map_err(|e| e.to_string()))), - clipboard_image: Some(Box::new(pasteboard::image_png)), - clipboard_html: Some(Box::new(pasteboard::html)), - clipboard_set_html: Some(Box::new(pasteboard::set_html)), + clipboard_image: pasteboard.then(|| Box::new(pasteboard::image_png) as Box Option>>), + clipboard_html: pasteboard.then(|| Box::new(pasteboard::html) as Box Option>), + clipboard_set_html: pasteboard.then(|| Box::new(pasteboard::set_html) as Box bool>), // Media is mixed and clocked by the output device; `DECKCRAFT_NO_AUDIO` plays silently. audio_out: std::env::var_os("DECKCRAFT_NO_AUDIO") .is_none() @@ -247,6 +253,11 @@ fn main() -> eframe::Result { false } }; + // `Default` lets winit choose, and winit takes Wayland whenever `WAYLAND_DISPLAY` is set. + #[cfg(all(unix, not(target_os = "macos")))] + let native_wayland = !x11 && std::env::var_os("WAYLAND_DISPLAY").is_some_and(|w| !w.is_empty()); + #[cfg(not(all(unix, not(target_os = "macos"))))] + let native_wayland = false; #[cfg(all(unix, not(target_os = "macos")))] if x11 { options.event_loop_builder = Some(Box::new(|b| { @@ -268,7 +279,7 @@ fn main() -> eframe::Result { options, Box::new(move |cc| { deckcraft_ui_egui::install_ime_pass_hooks(&cc.egui_ctx); - let mut app = SlideApp::new(Session::new(), services()); + let mut app = SlideApp::new(Session::new(), services(native_wayland)); load_prefs(&mut app); app.enable_update_checks(); // AutoRecover: reopen what a previous run left unsaved, then keep it current. @@ -335,6 +346,26 @@ mod tests { assert_eq!(stdout.contains("on_exit returned"), !cfg!(target_os = "macos"), "{stdout}"); } + /// The egui 0.37 migration (#1350) left `clipboard` out of eframe's features. egui then + /// simulated a clipboard inside the app: nothing pasted from other apps, and Ctrl+C/Ctrl+V + /// lost text that went out as HTML. Keep the OS clipboard on. + #[test] + fn eframe_uses_the_os_clipboard() { + let manifest = include_str!("../Cargo.toml"); + let eframe = manifest.lines().find(|l| l.starts_with("eframe = ")).unwrap_or_default(); + assert!(eframe.contains("\"clipboard\""), "eframe must enable the OS clipboard: {eframe}"); + } + + /// On native Wayland, the X11-only pasteboard would bypass egui's Wayland clipboard; elsewhere + /// it carries HTML and pictures beside egui's text. + #[test] + fn the_pasteboard_stays_off_native_wayland() { + let s = services(true); + assert!(s.clipboard_html.is_none() && s.clipboard_set_html.is_none() && s.clipboard_image.is_none()); + let s = services(false); + assert!(s.clipboard_html.is_some() && s.clipboard_set_html.is_some() && s.clipboard_image.is_some()); + } + #[test] fn help_exits_instead_of_opening_a_file() { assert!(matches!(startup(None, ["--help".to_string()]), Startup::Help)); diff --git a/docs/gaps.md b/docs/gaps.md index 29edfd573..75a92355b 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Where DeckCraft falls short of PowerPoint -> **Last reviewed:** 2026-10-30 · **Last updated:** 2026-10-30 · **Change:** minor (slide-show hit testing follows each shape’s own animation state; scale and rotation covered; previous: trivial, AutoFormat lists run independently of Replace text as you type; previous: minor, slide-show click targets follow animated shapes and text links; previous: minor, Animation Pane ▸ Play From; previous: minor, native chart payloads stored in bounded ZIP members; previous: major, community PR wave 2026-10-14: soak tests, PPTX corpus, comment threads (#70), embedded fonts, SmartArt Text Pane, Animation Pane timeline, Hunspell spelling, thesaurus, AutoCorrect, 14 new dialogs, pen pressure and trackpad gestures; duplicated entries and headers folded; previous: minor, 3-D bevel, camera and face lighting rendered) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) +> **Last reviewed:** 2026-10-30 · **Last updated:** 2026-11-01 · **Change:** major (workflow-breaking regression fixed: Ctrl+C/X/V use the system clipboard again; #1414 to re-test on Windows; previous: minor, slide-show hit testing follows each shape’s own animation state; scale and rotation covered; previous: trivial, AutoFormat lists run independently of Replace text as you type; previous: minor, slide-show click targets follow animated shapes and text links; previous: minor, Animation Pane ▸ Play From; previous: minor, native chart payloads stored in bounded ZIP members; previous: major, community PR wave 2026-10-14: soak tests, PPTX corpus, comment threads (#70), embedded fonts, SmartArt Text Pane, Animation Pane timeline, Hunspell spelling, thesaurus, AutoCorrect, 14 new dialogs, pen pressure and trackpad gestures; duplicated entries and headers folded; previous: minor, 3-D bevel, camera and face lighting rendered) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) Every known shortfall, one entry each, ranked by how much it stops someone who presents with PowerPoint from switching. This is the work list: pick from the top. Numbers are summarized in @@ -161,7 +161,7 @@ Detail in [file-format-parity.md](file-format-parity.md). - **Estimate:** 3–5 h. **Beta blocker.** ### Image paste fails on Windows (#1414) -- **Evidence:** #53 is closed (PR #88 pastes an image-only clipboard as a picture); #1414 (Ctrl+V fails to paste external images on Windows) is open. Linux was not re-checked after #53 closed. +- **Evidence:** #53 is closed (PR #88 pastes an image-only clipboard as a picture); #1414 (Ctrl+V fails to paste external images on Windows) is open. From the egui 0.37 migration (#1350, v0.11.1) to 0.14.1 the desktop build left out eframe's `clipboard` feature, so egui simulated a clipboard inside the app and Ctrl+V never read the system clipboard on any platform. Fixed 2026-11-01. #1414 may have the same cause: re-test on Windows. - **Impact:** copy-paste of screenshots is a core workflow. - **Estimate:** 2–4 h. **Beta blocker.** @@ -368,6 +368,7 @@ Detail in [localization-parity.md](localization-parity.md). | Date | Change | Summary | |---|---|---| +| 2026-11-01 | major | Workflow-breaking regression: image paste entry: the OS clipboard was off from #1350 to 0.14.1; Linux re-checked, Windows #1414 to re-test | | 2026-10-30 | minor | Slide-show click targets use each shape’s own animation state; scale and rotation test added | | 2026-10-28 | trivial | Automatic lists now run independently of Replace text as you type; proofing gap description updated | | 2026-10-27 | minor | Refreshed against merged PRs: removed the Morph alignment entry (#67 merged 2026-10-14); #77 (animation rewind, PR #83) is fixed, leaving #74 in the round-trip gap; #75 was closed unmerged, so #60 stays open with no fix PR; #53 is closed and the image-paste gap is now Windows #1414; Reuse Slides (#1103) and Compare reject (#850) noted in the smaller rows; the duplicate header line is gone | diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index 0c0d3ec60..9a9094780 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -36,7 +36,7 @@ The summary between ` | Automation (✱) | 100% | | Platforms (✱) | 67% | -Open P0 items: Contextual tabs (Shape Format, Picture Format, Table Design/Layout, Chart Design), Export to PDF (slides, notes pages, handouts; text layer, links, bookmarks; vector artwork pending), Format Shape pane, Font, size, bold, italic, underline, strikethrough (only Regular/Bold/Italic faces, #69), Edit chart data, Crop (and crop to shape, aspect ratio), Paste image from clipboard (fails on Windows, #1414; Linux not re-checked), Audio/video playback in the show (WMA/WMV not decodable yet), Animation pane (reorder, timing), Presenter view (notes, next slide, timer), macOS, Windows, Linux builds. +Open P0 items: Contextual tabs (Shape Format, Picture Format, Table Design/Layout, Chart Design), Export to PDF (slides, notes pages, handouts; text layer, links, bookmarks; vector artwork pending), Format Shape pane, Font, size, bold, italic, underline, strikethrough (only Regular/Bold/Italic faces, #69), Edit chart data, Crop (and crop to shape, aspect ratio), Paste image from clipboard (fails on Windows, #1414, re-test after the 2026-11-01 OS-clipboard fix), Audio/video playback in the show (WMA/WMV not decodable yet), Animation pane (reorder, timing), Presenter view (notes, next slide, timer), macOS, Windows, Linux builds. ## Rows @@ -187,7 +187,7 @@ Open P0 items: Contextual tabs (Shape Format, Picture Format, Table Design/Layou | Pictures | Picture styles and borders | P1 | D | | Pictures | Change / reset picture | P1 | D | | Pictures | Compress pictures | P2 | D | -| Pictures | Paste image from clipboard (fails on Windows, #1414; Linux not re-checked) | P0 | P | +| Pictures | Paste image from clipboard (fails on Windows, #1414, re-test after the 2026-11-01 OS-clipboard fix) | P0 | P | | Pictures | Insert screenshot | P2 | M | | Media | Insert audio (any common format) | P0 | D | | Media | Insert video | P1 | D | From e1cfe8516e444af9357d5ea135f9b067de0bc70e Mon Sep 17 00:00:00 2001 From: Stephan Schott-Verdugo Date: Sun, 1 Nov 2026 22:29:43 +0100 Subject: [PATCH 069/716] Paste and duplicate keep a placeholder's inherited look A placeholder copied or duplicated on a slide became a regular shape by clearing `ph`, which also dropped everything it inherited from its layout and master: the title's 44 pt heading font, the body's bullets and indent levels, autofit and the box. Without `ph` the text fell back to the presentation's default style (18 pt, no bullets), on Ctrl+V and the context menu alike. `resolve::detach_placeholder` makes the inherited box, fill, line, effects, body properties and every level's text style the shape's own before `ph` is cleared. Theme references stay references, so the default paste still follows the destination theme. Copy (so Cut and pasting into another deck work after the source is gone) and Duplicate use it. Co-Authored-By: Claude Opus 5.5 --- ROADMAP.md | 3 +- crates/engine/src/cmd/edit.rs | 15 ++++++- crates/engine/src/tests.rs | 85 +++++++++++++++++++++++++++++++++++ crates/model/src/resolve.rs | 39 ++++++++++++++++ 4 files changed, 140 insertions(+), 2 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 6255c9421..fd17b3a1c 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,7 +2,7 @@ **Stage: alpha** · next: beta, ~20 points and ~120–210 h away -> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-11-01 · **Change:** major (fix for a workflow-breaking regression: Ctrl+C/X/V use the system clipboard again, broken for all text and objects from 0.11.1 to 0.14.1; stage and scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) +> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-11-01 · **Change:** major (fix for a workflow-breaking regression: Ctrl+C/X/V use the system clipboard again, broken for all text and objects from 0.11.1 to 0.14.1; pasted and duplicated placeholders keep their look; stage and scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-30 · **Change:** trivial (progress log: read-only `slide.actions` lists shape and table text actions; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-27 · **Change:** trivial (progress log: Set Up Slide Show ▸ Keep mouse cursor visible, #1445; stage and scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-26 · **Change:** trivial (progress log: dragging several selected slides moves them all; previous: trivial, progress log: Edit Points handle drags with Shift, Ctrl/Cmd or Alt/Option set the point type; previous: trivial, progress log: scroll bars on the zoomed slide pane, #1157; previous: minor, native chart payloads stored in bounded ZIP members; previous: major, community PR wave 2026-10-14: ~60 landed items in the progress log, among them the Font, Paragraph, Photo Album, theme colour and font and Date and Time dialogs, presenter and show controls, the SmartArt Text Pane and PPTX corpus slices; breadth 84% after `cargo xtask parity`, ready stays ~55%, stage stays alpha; duplicated rows and headers folded; previous: minor, hours to ~95% per audience added) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) @@ -148,6 +148,7 @@ app's JSON control channel (`deckcraft --control PORT`). | Date | What landed | |---|---| +| 2026-11-01 | Copy, Cut, Paste and Duplicate of a title, body or other placeholder on a slide keep its look: the copy is a regular shape that takes the size, font, bullets, indents, autofit and box its layout and master gave it, instead of 18 pt unbulleted text | | 2026-11-01 | Clipboard: Ctrl+C, Ctrl+X and Ctrl+V use the system clipboard again, so text and pictures paste from other apps and in-app copies paste back. Since the egui 0.37 migration (#1350) the desktop build had a clipboard that only worked inside the app. On native Wayland, text goes through egui's Wayland clipboard; HTML stays on X11, macOS and Windows | | 2026-10-30 | Print-preview tests use the URL emitted by egui and its exact file path; previews are explicitly removed before the macOS process exits | | 2026-10-30 | `slide.actions` lists shape click and hover actions and text-run hyperlinks (including table cells and grouped shapes) for audit; listing never runs an action. The UI pane is a follow-up | diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index f084c6225..9674bb8ad 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -120,6 +120,13 @@ fn copy_inner(s: &mut Session, p: &Value) -> Result { }) }) .collect(); + // A placeholder pastes on a slide as a regular shape; it keeps the look it inherited here. + let mut shapes = shapes; + if st.selection.target == crate::Target::Slides + && let Some(ctx) = st.current_slide().and_then(|sl| deckcraft_model::resolve::Ctx::for_slide(&st.doc, sl)) + { + shapes.iter_mut().for_each(|sh| deckcraft_model::resolve::detach_placeholder(&ctx, sh)); + } let mids = crate::media_refs::shapes_media(&shapes); let media = st.doc.media.iter().filter(|m| mids.contains(&m.id)).cloned().collect(); let plain = shapes.iter().filter_map(|x| x.text.as_ref().map(|t| t.text())).collect::>().join("\n"); @@ -340,7 +347,7 @@ fn paste(s: &mut Session, p: &Value) -> Result { x.x += off; x.y += off; } - // A pasted placeholder becomes a regular shape keeping its look. + // A pasted placeholder becomes a regular shape; copying gave it its look. if sh.ph.is_some() && sel.target == crate::Target::Slides { sh.ph = None; } @@ -533,6 +540,12 @@ fn duplicate(s: &mut Session, p: &Value) -> Result { let mut copies: Vec = list.iter().filter(|x| ids.contains(&x.id)).cloned().collect(); let sources: Vec = copies.iter().map(|c| c.id).collect(); let boxes: Vec<_> = copies.iter().map(|c| xfrm_of(doc, sel, c)).collect(); + // A duplicated placeholder becomes a regular shape that keeps the look it inherited. + if sel.target == crate::Target::Slides + && let Some(ctx) = doc.slides.get(sel.slide).and_then(|sl| deckcraft_model::resolve::Ctx::for_slide(doc, sl)) + { + copies.iter_mut().for_each(|c| deckcraft_model::resolve::detach_placeholder(&ctx, c)); + } // Duplicating the copies of the last Duplicate again repeats how far they were moved // since (#966); anything else gets the usual offset. let (dx, dy) = last diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index a687de95c..eec43cc4a 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -214,6 +214,91 @@ fn clipboard_copy_paste_shapes_and_slides() { assert!(s.doc().unwrap().doc.validate().is_empty()); } +/// The resolved look of every paragraph and run of shape `id` on the current slide: size, font, +/// colour, bold, bullet, indent, alignment, and the box's insets and anchor. +fn resolved_look(s: &Session, id: ShapeId) -> String { + use deckcraft_model::resolve; + let st = s.doc().unwrap(); + let slide = st.current_slide().unwrap(); + let ctx = resolve::Ctx::for_slide(&st.doc, slide).unwrap(); + let sh = st.shape(id).unwrap(); + let t = sh.text.as_ref().unwrap(); + let b = resolve::body(&ctx, sh); + let mut out = format!("body {:?} {:?} {:?}\n", b.anchor, b.inset_l, b.autofit); + for p in &t.paragraphs { + let pp = resolve::para(&ctx, sh, p); + out += &format!("para {:?} {:?} {:?} {:?}\n", pp.align, pp.margin_left, pp.indent, pp.bullet); + for r in &p.runs { + let rp = resolve::run(&ctx, sh, p, &r.props); + out += &format!(" run {:?} {:?} {:?} {:?}\n", rp.size, rp.font, rp.bold, rp.fill); + } + } + out +} + +/// A placeholder pasted or duplicated on a slide becomes a regular shape, and keeps the look its +/// layout and master gave it: the title's size and font, the body's bullets and indents. Before, +/// the copy fell back to the master's other-text style (18 pt, no bullets). +#[test] +fn a_pasted_or_duplicated_placeholder_keeps_its_inherited_look() { + let mut s = session(); + s.execute("slide.new", &json!({})).unwrap(); + let phs: Vec = s.doc().unwrap().current_slide().unwrap().shapes.iter().filter(|x| x.ph.is_some()).map(|x| x.id).collect(); + assert!(phs.len() >= 2, "a title and a body placeholder"); + for (k, id) in phs.iter().enumerate() { + s.execute("text.set", &json!({"id": id.0, "text": format!("Placeholder {k}\nSecond line")})).unwrap(); + } + for id in phs { + let want = resolved_look(&s, id); + for cmd in ["paste", "duplicate"] { + s.execute("selection.select", &json!({"id": id.0})).unwrap(); + if cmd == "paste" { + s.execute("edit.copy", &json!({})).unwrap(); + s.execute("edit.paste", &json!({})).unwrap(); + } else { + s.execute("edit.duplicate", &json!({})).unwrap(); + } + let copy = s.doc().unwrap().selection.shapes[0]; + assert_ne!(copy, id); + assert!(s.doc().unwrap().shape(copy).unwrap().ph.is_none(), "{cmd}: the copy is a regular shape"); + assert_eq!(resolved_look(&s, copy), want, "{cmd} of placeholder {}", id.0); + } + } + assert!(s.doc().unwrap().doc.validate().is_empty()); +} + +/// The same on every text placeholder of the sample deck (titles, bulleted bodies, subtitles). +#[test] +fn sample_placeholders_paste_with_their_look() { + let mut s = Session::new(); + crate::sample::open_sample(&mut s).unwrap(); + let slides = s.doc().unwrap().doc.slides.len(); + let mut checked = 0; + for i in 0..slides { + s.execute("slide.go", &json!({"index": i})).unwrap(); + let phs: Vec = s + .doc() + .unwrap() + .current_slide() + .unwrap() + .shapes + .iter() + .filter(|x| x.ph.is_some() && x.text.as_ref().is_some_and(|t| !t.is_empty())) + .map(|x| x.id) + .collect(); + for id in phs { + let want = resolved_look(&s, id); + s.execute("selection.select", &json!({"id": id.0})).unwrap(); + s.execute("edit.copy", &json!({})).unwrap(); + s.execute("edit.paste", &json!({})).unwrap(); + let copy = s.doc().unwrap().selection.shapes[0]; + assert_eq!(resolved_look(&s, copy), want, "slide {i}, placeholder {}", id.0); + checked += 1; + } + } + assert!(checked >= 3, "the sample has text placeholders ({checked})"); +} + #[test] fn pasted_shapes_get_the_next_automatic_name() { let mut s = session(); diff --git a/crates/model/src/resolve.rs b/crates/model/src/resolve.rs index 8d87229f3..8cf87582d 100644 --- a/crates/model/src/resolve.rs +++ b/crates/model/src/resolve.rs @@ -218,6 +218,45 @@ pub fn effects(ctx: &Ctx, shape: &Shape) -> (Option, Option) { (None, None) } +/// Turn a placeholder into a regular shape that looks the same: what it inherited from its layout +/// and master placeholders (position, fill, line, effects, style, body properties and the text +/// style of every outline level, the master's title or body style included) becomes its own, and +/// `ph` is cleared. A shape that is not a placeholder is left as it is. +/// +/// Theme references (`+mj-lt`, scheme colours) stay references, so the copy still follows the +/// destination theme, as PowerPoint's default paste does. +pub fn detach_placeholder(ctx: &Ctx, shape: &mut Shape) { + if shape.ph.is_none() { + return; + } + let (lp, mp) = parents(ctx, shape); + let parents = [lp, mp].into_iter().flatten(); + shape.xfrm = Some(xfrm(ctx, shape)); + if shape.fill.is_none() && shape.style.is_none() { + shape.fill = parents.clone().find_map(|s| s.fill.clone()); + } + if shape.style.is_none() { + shape.style = parents.clone().find_map(|s| s.style.clone()); + } + if shape.effects.is_none() { + shape.effects = parents.clone().find_map(|s| s.effects.clone()); + } + let mut line = shape.line.clone(); + for p in parents.filter_map(|s| s.line.as_ref()) { + line.get_or_insert_with(Line::default).inherit(p); + } + shape.line = line; + if shape.text.is_some() { + let body = body(ctx, shape); + let levels: Vec> = (0..9).map(|l| Some(level_style(ctx, shape, l))).collect(); + if let Some(t) = shape.text.as_mut() { + t.body = body; + t.list_style = ListStyle { levels }; + } + } + shape.ph = None; +} + /// Body properties with defaults filled in. pub fn body(ctx: &Ctx, shape: &Shape) -> BodyProps { let (lp, mp) = parents(ctx, shape); From f006b5d8cef8ed499f14a16f58510b2dd0aaa7ef Mon Sep 17 00:00:00 2001 From: Stephan Schott-Verdugo Date: Sun, 1 Nov 2026 22:38:05 +0100 Subject: [PATCH 070/716] Ctrl+V pastes a picture copied in a browser, not its link A browser's Copy Image puts the picture on the clipboard together with text that only names it (the address and alt text, or Firefox's UTF-16 text/x-moz-url read as UTF-8) and an HTML fragment. Ctrl+V only looked for a picture when the text was empty, so it pasted a text box with the link. When the text or HTML only names a picture, paste the picture; with no picture on the clipboard the link still pastes as text. Co-Authored-By: Claude Opus 5.5 --- ROADMAP.md | 1 + crates/ui-egui/src/app/clipboard.rs | 46 +++++++++++++++++++++++++++++ crates/ui-egui/src/app/keys.rs | 6 ++-- crates/ui-egui/src/tests.rs | 44 +++++++++++++++++++++++++++ docs/gaps.md | 2 +- 5 files changed, 96 insertions(+), 3 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index fd17b3a1c..42ccd19dc 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -148,6 +148,7 @@ app's JSON control channel (`deckcraft --control PORT`). | Date | What landed | |---|---| +| 2026-11-01 | Ctrl+V of a picture copied in a browser (Copy Image) pastes the picture, not a text box with its link and alt text; the link still pastes as text when no picture came with it | | 2026-11-01 | Copy, Cut, Paste and Duplicate of a title, body or other placeholder on a slide keep its look: the copy is a regular shape that takes the size, font, bullets, indents, autofit and box its layout and master gave it, instead of 18 pt unbulleted text | | 2026-11-01 | Clipboard: Ctrl+C, Ctrl+X and Ctrl+V use the system clipboard again, so text and pictures paste from other apps and in-app copies paste back. Since the egui 0.37 migration (#1350) the desktop build had a clipboard that only worked inside the app. On native Wayland, text goes through egui's Wayland clipboard; HTML stays on X11, macOS and Windows | | 2026-10-30 | Print-preview tests use the URL emitted by egui and its exact file path; previews are explicitly removed before the macOS process exits | diff --git a/crates/ui-egui/src/app/clipboard.rs b/crates/ui-egui/src/app/clipboard.rs index 19fd48bf1..f6003dd04 100644 --- a/crates/ui-egui/src/app/clipboard.rs +++ b/crates/ui-egui/src/app/clipboard.rs @@ -11,6 +11,52 @@ pub(crate) fn system_clipboard_text(t: &str) -> String { if t.is_empty() { OBJECTS_MARKER.to_string() } else { t.to_string() } } +/// Whether pasted `text` (and the clipboard's `html`) only name a picture that is on the clipboard +/// too, as a browser's Copy Image leaves them: the picture's address, perhaps followed by its alt +/// text, or HTML that is a lone ``. Then Ctrl+V pastes the picture, as PowerPoint does. +/// Text with NULs is UTF-16 read as UTF-8 (Firefox's `text/x-moz-url`), never words to keep. +pub(crate) fn names_a_picture(text: &str, html: Option<&str>) -> bool { + if text.contains('\0') { + return true; + } + if let Some(h) = html + && h.to_ascii_lowercase().contains("`/`"); + } else if rest.starts_with('<') { + i = skip_to(">"); + } else { + let end = rest.find('<').map_or(html.len(), |e| i + e); + out.push_str(&html[i..end]); + i = end; + } + } + out.replace(" ", " ") +} + impl SlideApp { /// Offer the copy or cut on the system clipboard. /// diff --git a/crates/ui-egui/src/app/keys.rs b/crates/ui-egui/src/app/keys.rs index d6903e82d..7523308c0 100644 --- a/crates/ui-egui/src/app/keys.rs +++ b/crates/ui-egui/src/app/keys.rs @@ -152,8 +152,10 @@ impl SlideApp { // Text keeps its HTML (bold, italic, underline) when the host can read it. let html = self.services.clipboard_html.as_mut().and_then(|f| f()).filter(|h| !h.is_empty()); // egui 0.37 sends `PasteImage` directly; the services fallback stays for - // integrations that still send an empty `Paste`. Never insert twice. - let img = if text.is_empty() && !pasted_image_event { self.services.clipboard_image.as_mut().and_then(|f| f()) } else { None }; + // integrations that still send an empty `Paste`, and for a browser's Copy + // Image, whose text is only the picture's link. Never insert twice. + let wants_picture = text.is_empty() || super::clipboard::names_a_picture(&text, html.as_deref()); + let img = if wants_picture && !pasted_image_event { self.services.clipboard_image.as_mut().and_then(|f| f()) } else { None }; let revision = self.session.active().map(|d| d.revision); let r = match img { Some(png) => self diff --git a/crates/ui-egui/src/tests.rs b/crates/ui-egui/src/tests.rs index 98f3b85c7..47192ad36 100644 --- a/crates/ui-egui/src/tests.rs +++ b/crates/ui-egui/src/tests.rs @@ -378,6 +378,50 @@ fn title_bar_export_opens_the_export_dialog() { assert_eq!(harness.state().dialog.as_ref().map(|d| d.id.as_str()), Some("export")); } +/// A browser's Copy Image puts the picture on the clipboard with text that only names it: the +/// address (and the alt text), and an `` fragment as HTML. Ctrl+V pastes the picture, as +/// PowerPoint does, instead of a text box with the link. Without a picture the link pastes as text. +#[test] +fn ctrl_v_pastes_the_picture_a_browser_copied_not_its_link() { + let url = "https://github.com/storytold/deckcraft/raw/main/assets/app-icon/hicolor/256x256/apps/ai.storyteller.deckcraft.png"; + let caption = format!("{url}\nDeckCraft icon: a presentation screen with a bar chart on an orange tile"); + for (text, html, with_picture, pictures_after) in [ + (caption.clone(), Some(format!("\"DeckCraft")), true, 1), + (url.to_string(), None, true, 1), + // Firefox's text/x-moz-url is UTF-16; read as UTF-8 it carries NULs. + (url.chars().flat_map(|c| [c, '\0']).collect(), None, true, 1), + (url.to_string(), None, false, 0), + ("See https://example.com for the photos".to_string(), None, true, 0), + ] { + let session = Session::with_new(); + let png = { + let d = session.active().unwrap(); + deckcraft_engine::cmd::file::render_png(&d.doc, 0, 0.1, false).0 + }; + let services = Services { + clipboard_image: Some(Box::new(move || with_picture.then(|| png.clone()))), + clipboard_html: Some(Box::new(move || html.clone())), + ..Default::default() + }; + let mut harness = egui_kittest::Harness::builder().with_size(egui::vec2(1200.0, 800.0)).build_ui_state( + |ui, app: &mut SlideApp| { + app.logic(ui.ctx()); + app.ui(ui); + }, + SlideApp::new(session, services), + ); + harness.run_steps(2); + let shapes_before = harness.state().session.active().unwrap().doc.slides[0].shapes.len(); + harness.event(egui::Event::Paste(text.clone())); + harness.run_steps(2); + let d = harness.state().session.active().unwrap(); + let shapes = &d.doc.slides[0].shapes; + let pictures = shapes.iter().filter(|s| matches!(s.kind, deckcraft_model::ShapeKind::Picture { .. })).count(); + assert_eq!(pictures, pictures_after, "{text:?}"); + assert_eq!(shapes.len(), shapes_before + 1, "one shape, picture or text, for {text:?}"); + } +} + /// #53: Ctrl+V did nothing for an image-only clipboard: egui-winit sends no Paste event for it and /// swallows the key press, so only the V release reaches the app. #[test] diff --git a/docs/gaps.md b/docs/gaps.md index 75a92355b..27c7ef7c7 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -161,7 +161,7 @@ Detail in [file-format-parity.md](file-format-parity.md). - **Estimate:** 3–5 h. **Beta blocker.** ### Image paste fails on Windows (#1414) -- **Evidence:** #53 is closed (PR #88 pastes an image-only clipboard as a picture); #1414 (Ctrl+V fails to paste external images on Windows) is open. From the egui 0.37 migration (#1350, v0.11.1) to 0.14.1 the desktop build left out eframe's `clipboard` feature, so egui simulated a clipboard inside the app and Ctrl+V never read the system clipboard on any platform. Fixed 2026-11-01. #1414 may have the same cause: re-test on Windows. +- **Evidence:** #53 is closed (PR #88 pastes an image-only clipboard as a picture); #1414 (Ctrl+V fails to paste external images on Windows) is open. From the egui 0.37 migration (#1350, v0.11.1) to 0.14.1 the desktop build left out eframe's `clipboard` feature, so egui simulated a clipboard inside the app and Ctrl+V never read the system clipboard on any platform. Fixed 2026-11-01, as is a browser's Copy Image on Linux, which pasted its link because Ctrl+V preferred any text over the picture. #1414 may have either cause: re-test on Windows. - **Impact:** copy-paste of screenshots is a core workflow. - **Estimate:** 2–4 h. **Beta blocker.** From 1192e5ef3076f7df1b239e2f4a14645ec53186b8 Mon Sep 17 00:00:00 2001 From: Stephan Schott-Verdugo Date: Sun, 1 Nov 2026 23:06:09 +0100 Subject: [PATCH 071/716] Detached placeholders follow each property's style precedence Review follow-up (CodeRabbit on #1658): - Text levels are resolved before the copy's style changes. A master placeholder's font reference reached the copy's text (body font in an accent colour for a title) although the original ignores it: text only takes the shape's or the layout placeholder's font reference. - Fill, line and effects come from where `resolve::fill`, `resolve::line` and `resolve::effects` take them: the first shape in the chain with an explicit value or a style. A layout's (or the slide's own) style no longer loses to an explicit fill, line or effect on the master. The copy gets one style whose references each come from the shape that supplied that property; unused references are neutral. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/tests.rs | 100 ++++++++++++++++++++++++++++++++++++ crates/model/src/resolve.rs | 71 ++++++++++++++++--------- 2 files changed, 147 insertions(+), 24 deletions(-) diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index eec43cc4a..26fb7b9cf 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -267,6 +267,106 @@ fn a_pasted_or_duplicated_placeholder_keeps_its_inherited_look() { assert!(s.doc().unwrap().doc.validate().is_empty()); } +/// The resolved fill, line and effects of shape `id` on the current slide, with their style colours. +fn resolved_box(s: &Session, id: ShapeId) -> String { + use deckcraft_model::resolve; + let st = s.doc().unwrap(); + let ctx = resolve::Ctx::for_slide(&st.doc, st.current_slide().unwrap()).unwrap(); + let sh = st.shape(id).unwrap(); + format!("{:?}\n{:?}\n{:?}", resolve::fill(&ctx, sh), resolve::line(&ctx, sh), resolve::effects(&ctx, sh)) +} + +/// Edit the title placeholders the current slide's title inherits from: its layout's and its +/// master's. Returns the slide title's id. +fn edit_title_parents( + s: &mut Session, + layout: impl FnOnce(&mut deckcraft_model::Shape), + master: impl FnOnce(&mut deckcraft_model::Shape), +) -> ShapeId { + let st = s.doc_mut().unwrap(); + let slide = st.current_slide().unwrap().clone(); + let title = slide.shapes.iter().find(|x| x.ph_type().is_some_and(|k| k.is_title())).unwrap().id; + let doc = std::sync::Arc::make_mut(&mut st.doc); + let m = std::sync::Arc::make_mut(&mut doc.masters[0]); + let lay = m.layouts.iter_mut().find(|l| l.id == slide.layout).unwrap(); + layout(lay.shapes.iter_mut().find(|x| x.ph_type().is_some_and(|k| k.is_title())).unwrap()); + master(m.shapes.iter_mut().find(|x| x.ph_type().is_some_and(|k| k.is_title())).unwrap()); + title +} + +/// A copied placeholder takes each of fill, line and effects from where the original does: a +/// style on the layout's placeholder (or on the slide's own) wins over an explicit value on the +/// master's, as `resolve::fill`, `resolve::line` and `resolve::effects` decide. +#[test] +fn a_pasted_placeholder_keeps_the_style_precedence_of_its_box() { + use deckcraft_color::SchemeSlot; + use deckcraft_model::{ColorRef, Effects, Fill, Line, ShapeStyle}; + for style_on_slide in [false, true] { + let mut s = session(); + s.execute("slide.new", &json!({})).unwrap(); + let style = ShapeStyle { + line_ref: (1, ColorRef::scheme(SchemeSlot::Accent2)), + fill_ref: (1, ColorRef::scheme(SchemeSlot::Accent1)), + effect_ref: (0, ColorRef::scheme(SchemeSlot::Accent3)), + font_ref: ("minor".into(), None), + }; + let layout_style = (!style_on_slide).then(|| style.clone()); + let title = edit_title_parents( + &mut s, + |l| l.style = layout_style, + |m| { + m.fill = Some(Fill::solid(ColorRef::scheme(SchemeSlot::Accent4))); + m.line = Some(Line::solid(ColorRef::scheme(SchemeSlot::Accent5), 20.0)); + m.effects = Some(Effects { soft_edge: Some(5.0), ..Default::default() }); + }, + ); + if style_on_slide { + s.edit(|doc, sel| { + let list = crate::shapes_mut(doc, sel).unwrap(); + list.iter_mut().find(|x| x.id == title).unwrap().style = Some(style.clone()); + Ok(()) + }) + .unwrap(); + } + s.execute("text.set", &json!({"id": title.0, "text": "Styled title"})).unwrap(); + let want = (resolved_box(&s, title), resolved_look(&s, title)); + s.execute("selection.select", &json!({"id": title.0})).unwrap(); + s.execute("edit.copy", &json!({})).unwrap(); + s.execute("edit.paste", &json!({})).unwrap(); + let copy = s.doc().unwrap().selection.shapes[0]; + assert_eq!((resolved_box(&s, copy), resolved_look(&s, copy)), want, "style on the slide: {style_on_slide}"); + } +} + +/// The master's placeholder style never reaches the copy's text: the original's text ignores it +/// (only the shape's or the layout's font reference counts), so the copy must too. +#[test] +fn a_pasted_placeholder_ignores_the_masters_font_reference() { + use deckcraft_color::SchemeSlot; + use deckcraft_model::{ColorRef, ShapeStyle}; + let mut s = session(); + s.execute("slide.new", &json!({})).unwrap(); + let title = edit_title_parents( + &mut s, + |l| l.style = None, + |m| { + m.style = Some(ShapeStyle { + line_ref: (0, ColorRef::scheme(SchemeSlot::Accent2)), + fill_ref: (0, ColorRef::scheme(SchemeSlot::Accent1)), + effect_ref: (0, ColorRef::scheme(SchemeSlot::Accent3)), + font_ref: ("minor".into(), Some(ColorRef::scheme(SchemeSlot::Accent6))), + }) + }, + ); + s.execute("text.set", &json!({"id": title.0, "text": "Title"})).unwrap(); + let want = (resolved_box(&s, title), resolved_look(&s, title)); + assert!(want.1.contains("+mj-lt"), "the title draws in the heading font: {}", want.1); + s.execute("selection.select", &json!({"id": title.0})).unwrap(); + s.execute("edit.duplicate", &json!({})).unwrap(); + let copy = s.doc().unwrap().selection.shapes[0]; + assert_eq!((resolved_box(&s, copy), resolved_look(&s, copy)), want); +} + /// The same on every text placeholder of the sample deck (titles, bulleted bodies, subtitles). #[test] fn sample_placeholders_paste_with_their_look() { diff --git a/crates/model/src/resolve.rs b/crates/model/src/resolve.rs index 8cf87582d..5f1651de9 100644 --- a/crates/model/src/resolve.rs +++ b/crates/model/src/resolve.rs @@ -4,7 +4,7 @@ use deckcraft_color::{ColorScheme, Rgba, SchemeSlot}; use deckcraft_geom::Xfrm; -use crate::style::{ColorRef, Effects, Fill, Line}; +use crate::style::{ColorRef, Effects, Fill, Line, ShapeStyle}; use crate::text::{Anchor, AutoFit, BodyProps, LevelStyle, ListStyle, ParaProps, RunProps}; use crate::{Background, Layout, Master, PhType, Presentation, Shape, Slide}; @@ -229,30 +229,53 @@ pub fn detach_placeholder(ctx: &Ctx, shape: &mut Shape) { if shape.ph.is_none() { return; } - let (lp, mp) = parents(ctx, shape); - let parents = [lp, mp].into_iter().flatten(); - shape.xfrm = Some(xfrm(ctx, shape)); - if shape.fill.is_none() && shape.style.is_none() { - shape.fill = parents.clone().find_map(|s| s.fill.clone()); - } - if shape.style.is_none() { - shape.style = parents.clone().find_map(|s| s.style.clone()); - } - if shape.effects.is_none() { - shape.effects = parents.clone().find_map(|s| s.effects.clone()); - } - let mut line = shape.line.clone(); - for p in parents.filter_map(|s| s.line.as_ref()) { - line.get_or_insert_with(Line::default).inherit(p); - } - shape.line = line; - if shape.text.is_some() { - let body = body(ctx, shape); - let levels: Vec> = (0..9).map(|l| Some(level_style(ctx, shape, l))).collect(); - if let Some(t) = shape.text.as_mut() { - t.body = body; - t.list_style = ListStyle { levels }; + // The text first: `level_style` reads the shape's own style, which changes below. + let text = shape.text.as_ref().map(|_| (body(ctx, shape), (0..9).map(|l| Some(level_style(ctx, shape, l))).collect::>())); + let own = shape.clone(); + let (lp, mp) = parents(ctx, &own); + let chain = [Some(&own), lp, mp].into_iter().flatten(); + + // Each property comes from where `fill`, `line` and `effects` take it: the first shape in the + // chain with an explicit value or a style. Lines merge explicit values up to the first styled + // shape, whose style line fills the rest. + let fill_src = chain.clone().find(|s| s.fill.is_some() || s.style.is_some()); + let effects_src = chain.clone().find(|s| s.effects.is_some() || s.style.is_some()); + let mut line = None; + let mut line_src = None; + for s in chain.clone() { + if let Some(l) = &s.line { + line.get_or_insert_with(Line::default).inherit(l); } + if s.style.is_some() { + line_src = Some(s); + break; + } + } + // Text takes its font reference from the shape's style or its layout placeholder's (a table's + // from its own only), never the master's. + let table = matches!(own.kind, crate::ShapeKind::Table(_)); + let font_src = own.style.as_ref().or(lp.filter(|_| !table).and_then(|s| s.style.as_ref())); + + // One style for the copy, each reference taken from the shape that supplied that property. A + // property with an explicit value ignores its reference, except a gradient without stops, + // which takes them from its own shape's style; a neutral reference (index 0) adds nothing. + let style_of = |s: Option<&Shape>| s.and_then(|s| s.style.clone()); + let neutral = (0, ColorRef::scheme(SchemeSlot::Tx1)); + let style = chain.clone().any(|s| s.style.is_some()).then(|| ShapeStyle { + fill_ref: style_of(fill_src).map_or_else(|| neutral.clone(), |st| st.fill_ref), + line_ref: style_of(line_src).map_or_else(|| neutral.clone(), |st| st.line_ref), + effect_ref: style_of(effects_src).map_or_else(|| neutral.clone(), |st| st.effect_ref), + font_ref: font_src.map_or_else(|| ("none".into(), None), |st| st.font_ref.clone()), + }); + + shape.xfrm = Some(xfrm(ctx, &own)); + shape.fill = fill_src.and_then(|s| s.fill.clone()); + shape.effects = effects_src.and_then(|s| s.effects.clone()); + shape.line = line; + shape.style = style; + if let (Some(t), Some((body, levels))) = (shape.text.as_mut(), text) { + t.body = body; + t.list_style = ListStyle { levels }; } shape.ph = None; } From b0b87c5cad6d258eb7c085dc1df7a5a51c4c5e97 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:37:53 +0100 Subject: [PATCH 072/716] Fix Unit::format printing "-0.00" for tiny negative lengths Found while testing crates/geom/src/lib.rs:72-76 Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/geom/src/lib.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/geom/src/lib.rs b/crates/geom/src/lib.rs index 3be72e03f..9ef790f3d 100644 --- a/crates/geom/src/lib.rs +++ b/crates/geom/src/lib.rs @@ -71,7 +71,10 @@ impl Unit { /// `2.08"` style text for a length in points. pub fn format(self, pt: f64) -> String { let v = pt / self.points_per_unit(); - let s = format!("{v:.2}"); + let mut s = format!("{v:.2}"); + if s.starts_with('-') && s[1..].bytes().all(|b| b == b'0' || b == b'.') { + s.remove(0); + } format!("{s}{}", self.suffix()) } /// Parses `2.5`, `2.5"`, `2.5 in`, `6 cm`, `30 pt`, `40px`, `5mm` into points. A bare number uses `self`. @@ -222,6 +225,14 @@ pub fn preset_flatten(path: &BezPath, f: &mut dyn FnMut(PathEl)) { mod tests { use super::*; + #[test] + fn format_has_no_negative_zero() { + assert_eq!(Unit::Points.format(-0.001), "0.00 pt"); + assert_eq!(Unit::Inches.format(-0.001), "0.00\""); + assert!(!Unit::Centimeters.format(-0.01).starts_with('-')); + assert_eq!(Unit::Points.format(-1.5), "-1.50 pt"); + } + #[test] fn emu_roundtrip_is_exact() { for emu in [0i64, 1, 12_699, 12_700, 914_400, 12_192_000, 6_858_000, -5, 123_456_789] { From 01220df57928a6148d4779eeea9b2fbbdb737c54 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Mon, 2 Nov 2026 04:51:01 -0500 Subject: [PATCH 073/716] design.background: check the index before a picture is added to the media Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/cmd/design/slide_background.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/design/slide_background.rs b/crates/engine/src/cmd/design/slide_background.rs index 92f3ce773..494b53be8 100644 --- a/crates/engine/src/cmd/design/slide_background.rs +++ b/crates/engine/src/cmd/design/slide_background.rs @@ -7,6 +7,8 @@ pub(super) fn background(s: &mut Session, p: &Value) -> Result { if bool_or(p, "copy", false) { return copy_slide_background(s); } + // Check the index before anything is edited: a picture is added to the media first. + let index = opt_usize_param(p, "index", "design.background")?; let props = p.get("pictureProps").filter(|v| v.is_object()).cloned(); let transparency = f64_param(p, "transparency"); let reset = bool_or(p, "reset", false); @@ -62,7 +64,6 @@ pub(super) fn background(s: &mut Session, p: &Value) -> Result { )); }; let all = bool_or(p, "all", false); - let index = opt_usize_param(p, "index", "design.background")?; if matches!(op, BgOp::Adjust) { let next = { let st = s.doc()?; From 5eb0b7d2c0492b2e648140a3ff8ec7f792e55e92 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Mon, 2 Nov 2026 04:51:13 -0500 Subject: [PATCH 074/716] docs: one revision row per doc for #1621, keep the Last reviewed dates Co-Authored-By: Claude Opus 5.5 --- ROADMAP.md | 4 +--- docs/gaps.md | 3 +-- docs/parity-checklist.md | 1 - docs/ui-parity.md | 3 +-- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index f5e084d3c..ecf27f318 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,7 +2,7 @@ **Stage: alpha** · next: beta, ~20 points and ~120–210 h away -> **Last reviewed:** 2026-11-01 · **Last updated:** 2026-11-01 · **Change:** trivial (locked No Fill and no-outline click-through regression coverage added; No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) +> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-11-01 · **Change:** trivial (locked No Fill and no-outline click-through regression coverage added; No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-30 · **Change:** trivial (progress log: read-only `slide.actions` lists shape and table text actions; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-27 · **Change:** trivial (progress log: Set Up Slide Show ▸ Keep mouse cursor visible, #1445; stage and scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-26 · **Change:** trivial (progress log: dragging several selected slides moves them all; previous: trivial, progress log: Edit Points handle drags with Shift, Ctrl/Cmd or Alt/Option set the point type; previous: trivial, progress log: scroll bars on the zoomed slide pane, #1157; previous: minor, native chart payloads stored in bounded ZIP members; previous: major, community PR wave 2026-10-14: ~60 landed items in the progress log, among them the Font, Paragraph, Photo Album, theme colour and font and Date and Time dialogs, presenter and show controls, the SmartArt Text Pane and PPTX corpus slices; breadth 84% after `cargo xtask parity`, ready stays ~55%, stage stays alpha; duplicated rows and headers folded; previous: minor, hours to ~95% per audience added) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) @@ -148,7 +148,6 @@ app's JSON control channel (`deckcraft --control PORT`). | Date | What landed | |---|---| -| 2026-11-01 | No Fill regression coverage now includes locked shapes (outline selectable, position unchanged by dragging) and empty shapes without an outline, locked or unlocked (#1621). Existing text, outline and interior-hit tests retained | | 2026-10-31 | No Fill shape interiors allow selection and editing of underlying objects, even when a quick style remains; hit-testing uses the renderer’s fill resolution. Outlines, rotation, text targets and actual fills keep their hit behaviour (#1621) | | 2026-10-30 | Print-preview tests use the URL emitted by egui and its exact file path; previews are explicitly removed before the macOS process exits | | 2026-10-30 | `slide.actions` lists shape click and hover actions and text-run hyperlinks (including table cells and grouped shapes) for audit; listing never runs an action. The UI pane is a follow-up | @@ -320,7 +319,6 @@ app's JSON control channel (`deckcraft --control PORT`). | Date | Change | Summary | |---|---|---| -| 2026-11-01 | trivial | No Fill tests cover locked outline selection without movement and click-through without an outline; fill row and parity scores unchanged (#1621) | | 2026-10-31 | trivial | No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged | | 2026-10-30 | trivial | Progress log: read-only slide action inspection; parity scores unchanged | | 2026-10-29 | trivial | Progress log: going back in the slide show reverses the left slide's transition (#1531). Scores and milestone names unchanged | diff --git a/docs/gaps.md b/docs/gaps.md index 77764f1cf..1fefa5d9d 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Where DeckCraft falls short of PowerPoint -> **Last reviewed:** 2026-11-01 · **Last updated:** 2026-11-01 · **Change:** trivial (locked No Fill and no-outline click-through regression coverage added; No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) +> **Last reviewed:** 2026-10-30 · **Last updated:** 2026-11-01 · **Change:** trivial (locked No Fill and no-outline click-through regression coverage added; No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) Every known shortfall, one entry each, ranked by how much it stops someone who presents with PowerPoint from switching. This is the work list: pick from the top. Numbers are summarized in @@ -368,7 +368,6 @@ Detail in [localization-parity.md](localization-parity.md). | Date | Change | Summary | |---|---|---| -| 2026-11-01 | trivial | No Fill tests cover locked outline selection without movement and click-through without an outline; fill row and parity scores unchanged (#1621) | | 2026-10-31 | trivial | No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged | | 2026-10-30 | minor | Slide-show click targets use each shape’s own animation state; scale and rotation test added | | 2026-10-28 | trivial | Automatic lists now run independently of Replace text as you type; proofing gap description updated | diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index f776f4aac..606f1228d 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -240,5 +240,4 @@ Open P0 items: Contextual tabs (Shape Format, Picture Format, Table Design/Layou | Date | Change | Summary | |---|---|---| -| 2026-11-01 | trivial | No Fill tests cover locked outline selection without movement and click-through without an outline; fill row and parity scores unchanged (#1621) | | 2026-10-31 | trivial | No Fill interior hit-testing follows resolved fill (#1621); fill row remains D and summary scores are unchanged | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index fd34a7928..0d4d5a649 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI parity with PowerPoint -> **Last reviewed:** 2026-11-01 · **Last updated:** 2026-11-01 · **Change:** trivial (locked No Fill and no-outline click-through regression coverage added; No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) +> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-11-01 · **Change:** trivial (locked No Fill and no-outline click-through regression coverage added; No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-26 · **Change:** trivial (dragging several selected slides moves them all; previous: trivial, Edit Points: Shift, Ctrl/Cmd or Alt/Option on a handle drag sets the point type; previous: trivial, scroll bars on the zoomed slide pane, #1157; previous: major, community PR wave 2026-10-14: 14 new dialogs (41 in all), Eyedropper, Export button, New Window, Grid Options, WordArt gallery and handles, Slide Sorter sections, Quick Access Toolbar, Format Background and Format Shape depth, rich-text clipboard; duplicated rows and headers folded; previous: minor, File tab / Backstage, #76) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-22 · **Change:** trivial (group fill and outline edits reach members, #1079; scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-24 · **Change:** trivial (Edit Points: Shift, Ctrl/Cmd or Alt/Option on a handle drag sets the point type; previous: trivial, scroll bars on the zoomed slide pane, #1157; previous: major, community PR wave 2026-10-14: 14 new dialogs (41 in all), Eyedropper, Export button, New Window, Grid Options, WordArt gallery and handles, Slide Sorter sections, Quick Access Toolbar, Format Background and Format Shape depth, rich-text clipboard; duplicated rows and headers folded; previous: minor, File tab / Backstage, #76) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) @@ -171,7 +171,6 @@ consistency is open (#73, #56). | Date | Change | Summary | |---|---|---| -| 2026-11-01 | trivial | No Fill tests cover locked outline selection without movement and click-through without an outline; fill row and parity scores unchanged (#1621) | | 2026-10-31 | trivial | No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged | | 2026-10-29 | trivial | Picture Format: the Picture Styles row shows as many styles as fit beside the groups after it (at least two) and a More arrow with all 24, as the Transitions and Animations galleries do; Crop and Size are in view in the default window (#1232) | | 2026-10-26 | trivial | Thumbnail pane and Slide Sorter: dragging one of several selected slides moves the whole selection | From ffd77c7db00fb080f02b92663b6ef006e9f706ae Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Mon, 2 Nov 2026 04:53:47 -0500 Subject: [PATCH 075/716] Spell check: a mark on trailing punctuation is trimmed with it Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/spell.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/spell.rs b/crates/engine/src/spell.rs index 8927ade5b..2dda5c6f4 100644 --- a/crates/engine/src/spell.rs +++ b/crates/engine/src/spell.rs @@ -726,8 +726,14 @@ pub fn paragraph_words(p: &deckcraft_model::Paragraph, default: &str) -> Vec a && !chars[b - 1].0.is_alphanumeric() && !deckcraft_model::words::is_combining_mark(chars[b - 1].0) { - b -= 1; + // Trim back to the last letter or digit, keeping only the marks that sit on it + // (a mark on a trailing apostrophe goes with the apostrophe). + while b > a { + let k = (a..b).rev().find(|&k| !deckcraft_model::words::is_combining_mark(chars[k].0)).unwrap_or(a); + if chars[k].0.is_alphanumeric() { + break; + } + b = k; } let text: String = chars[a..b].iter().map(|c| c.0).collect(); if text.is_empty() || text.chars().any(|c| c.is_ascii_digit()) || !text.chars().any(char::is_alphabetic) { @@ -827,6 +833,13 @@ SFX D Y 1\nSFX D 0 ed/S .\n"; assert_eq!(w, ["Das", "na\u{ef}ve", "Caf\u{e9}", "und", "cafe\u{301}", "na\u{308}ive"]); } + #[test] + fn a_mark_on_trailing_punctuation_is_trimmed_with_it() { + let p = deckcraft_model::Paragraph::new("word'\u{301} cafe\u{301}' x"); + let w: Vec = paragraph_words(&p, "en-US").into_iter().map(|w| w.text).collect(); + assert_eq!(w, ["word", "cafe\u{301}", "x"]); + } + #[test] fn curly_apostrophe_matches_ascii_entry() { let d = Dictionary::parse(AFF.as_bytes(), "2\ndon't\nwork\n".as_bytes()); From ea9dad8ef988362f4a365d5cf44f1d525b00ad5b Mon Sep 17 00:00:00 2001 From: Naseq Date: Mon, 2 Nov 2026 15:04:05 +0430 Subject: [PATCH 076/716] Transitions: play transition preview from previous slide when Preview is clicked (#1654) - When Preview is clicked on the Transitions ribbon, initialize Show with start_transition_preview from the prior slide into the selected slide (or from black for slide 0). - If tr.old is unset for a non-part transition with tr.from, render the previous slide texture on the first frame so the transition blends cleanly. - Indicate active playback on the Preview button while previewing. - Regression tests for transitions from previous slide and from black on slide 0. --- crates/ui-egui/src/ribbon/transitions.rs | 13 +++++---- crates/ui-egui/src/show.rs | 21 +++++++++++++++ crates/ui-egui/src/show/tests.rs | 34 ++++++++++++++++++++++++ crates/ui-egui/src/show/ui.rs | 10 +++++++ 4 files changed, 73 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/ribbon/transitions.rs b/crates/ui-egui/src/ribbon/transitions.rs index 3f43ebd98..6986d828c 100644 --- a/crates/ui-egui/src/ribbon/transitions.rs +++ b/crates/ui-egui/src/ribbon/transitions.rs @@ -12,11 +12,14 @@ pub(super) fn transitions(app: &mut SlideApp, ui: &mut Ui) { let cur = app.session.active().and_then(|d| d.current_slide().and_then(|s| s.transition.clone())); let kind = cur.as_ref().map(|t| t.kind.clone()).unwrap_or_else(|| "none".into()); group(ui, |ui| { - if big_button(ui, Icon::Preview, "Preview", true).clicked() { - let from = app.session.active().map(|d| d.selection.slide).unwrap_or(0); - app.start_show(from, true); - if let Some(s) = app.show.as_mut() { - s.preview_only = true; + let playing = app.show.as_ref().is_some_and(|s| s.preview_only); + let (resp, _) = widgets::big_button_ex(ui, Icon::Preview, "Preview", true, false, playing); + if resp.on_hover_text("Play this slide's transition").clicked() { + let to = app.session.active().map(|d| d.selection.slide).unwrap_or(0); + app.start_show(to, true); + let now = ui.input(|i| i.time); + if let (Some(s), Some(d)) = (app.show.as_mut(), app.session.active()) { + s.start_transition_preview(&d.doc, now); } } }); diff --git a/crates/ui-egui/src/show.rs b/crates/ui-egui/src/show.rs index 1896e3be7..7bd2edf7d 100644 --- a/crates/ui-egui/src/show.rs +++ b/crates/ui-egui/src/show.rs @@ -261,6 +261,27 @@ impl Show { } } + /// Play this slide's transition from the previous slide (or black for slide 0) as a preview (#1654). + pub fn start_transition_preview(&mut self, doc: &Presentation, now: f64) { + let i = self.state.slide; + let from = i.checked_sub(1); + let (kind, option, dur) = doc + .slides + .get(i) + .and_then(|s| s.transition.as_ref()) + .map(|t| (t.kind.clone(), t.option.clone(), t.duration_ms as f64 / 1000.0)) + .unwrap_or(("none".into(), String::new(), 0.0)); + self.trans = if kind != "none" && dur > 0.0 && !doc.show.without_animation { + Some(Transition { old: None, from, morph: None, parts: None, start: now, kind, option, dur, reverse: false }) + } else { + None + }; + self.preview_only = true; + self.slide_start = now; + self.step_start = now; + self.step_end = now; + } + /// Identity of the show state a queued window-point event belongs to. pub(crate) fn input_state(&self) -> ShowInputState { let bits = |v: f32| if v.is_finite() { v.to_bits() } else { 0 }; diff --git a/crates/ui-egui/src/show/tests.rs b/crates/ui-egui/src/show/tests.rs index a1069a5bb..5e39bd18e 100644 --- a/crates/ui-egui/src/show/tests.rs +++ b/crates/ui-egui/src/show/tests.rs @@ -1238,3 +1238,37 @@ fn a_preview_of_an_edited_presentation_is_rendered_again() { let tex = harness.state().1.next_tex.as_ref().map(|(d, k, _)| (std::sync::Arc::ptr_eq(d, &edited), *k)); assert_eq!(tex, Some((true, 1)), "the preview comes from the edited presentation"); } + +/// #1654: Preview on the Transitions ribbon plays the current slide's transition from the +/// previous slide into the current slide, and exits when finished. +#[test] +fn transition_preview_plays_from_the_previous_slide() { + let mut s = deckcraft_engine::Session::with_new(); + s.execute("slide.new", &json!({})).unwrap(); + s.execute("transition.set", &json!({"kind": "push", "index": 1, "duration": 1.0})).unwrap(); + let doc = s.active().unwrap().doc.clone(); + let mut show = Show::new(&doc, 1, true, false); + show.start_transition_preview(&doc, 10.0); + assert!(show.preview_only); + let tr = show.trans.as_ref().expect("transition preview is playing"); + assert_eq!(tr.kind, "push"); + assert_eq!(tr.from, Some(0), "enters from slide 0 into slide 1"); + assert_eq!(tr.dur, 1.0); + assert!(!tr.reverse); + assert_eq!(tr.start, 10.0); +} + +/// #1654: Transition preview for slide 0 plays with from = None (transitioning from black). +#[test] +fn transition_preview_for_first_slide_transitions_from_black() { + let mut s = deckcraft_engine::Session::with_new(); + s.execute("transition.set", &json!({"kind": "fade", "index": 0, "duration": 500})).unwrap(); + let doc = s.active().unwrap().doc.clone(); + let mut show = Show::new(&doc, 0, true, false); + show.start_transition_preview(&doc, 5.0); + assert!(show.preview_only); + let tr = show.trans.as_ref().expect("fade transition preview is playing"); + assert_eq!(tr.kind, "fade"); + assert_eq!(tr.from, None, "slide 0 transitions from black (None)"); + assert_eq!(tr.dur, 0.5); +} diff --git a/crates/ui-egui/src/show/ui.rs b/crates/ui-egui/src/show/ui.rs index 71107f94f..321f8116d 100644 --- a/crates/ui-egui/src/show/ui.rs +++ b/crates/ui-egui/src/show/ui.rs @@ -388,6 +388,16 @@ fn draw_transition(show: &mut Show, f: &Fr, sl: &Sl, painter: &egui::Painter, te if tr.parts.is_none() && deckcraft_anim::uses_slide_parts(&tr.kind, &tr.option) { tr.parts = Some(part_textures(ctx, doc, tr.from, idx, size)); } + if tr.old.is_none() + && let Some(prev) = tr.from + && !deckcraft_anim::uses_slide_parts(&tr.kind, &tr.option) + { + let threads = + if cfg!(target_arch = "wasm32") { 0 } else { std::thread::available_parallelism().map(|n| n.get().min(8) as u16).unwrap_or(0) }; + let opts = RenderOpts { scale: size.0 as f64 / doc.slide_size.width.max(1.0), size: Some(size), threads, ..Default::default() }; + let img = deckcraft_render::render_slide(doc, prev, &opts); + tr.old = Some(crate::textures::upload(ctx, "trans-old", crate::textures::to_color_image(&img, false))); + } let aspect = doc.slide_size.width / doc.slide_size.height.max(1.0); let part = |k: usize| tr.parts.as_ref().and_then(|p| p.get(k).cloned().flatten()); let parts = [part(0), part(1), part(2), part(3)]; From 1a16bf975c8416e668ca33d77a91de3d466ffe31 Mon Sep 17 00:00:00 2001 From: Hamza Date: Mon, 2 Nov 2026 15:43:23 +0500 Subject: [PATCH 077/716] format.font: a script typeface that is not a string is refused `str_param` answers `None` both for an absent key and for a key holding something that is not a string, so `typeface_param` read the two as the same thing. With `{"family": "Lato", "eastAsia": 42}` the command set the Latin typeface, left the East Asian one as it was and reported success -- the one thing the caller asked for was the one thing that did not happen (noted in review). Read through `p.get(key)` instead, the way `opt_usize_param` and `id_param` already read theirs: an absent key, and an explicit `null`, still mean the script keeps its typeface; anything else present has to be a string. `family` is judged the same way, so `{"family": 42}` now says the key is not a typeface name rather than that it is missing. --- crates/engine/src/cmd/format/font.rs | 23 ++++++++++++++--------- crates/engine/src/cmd/text.rs | 24 ++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/crates/engine/src/cmd/format/font.rs b/crates/engine/src/cmd/format/font.rs index db7e4ec6e..b8bc622f8 100644 --- a/crates/engine/src/cmd/format/font.rs +++ b/crates/engine/src/cmd/format/font.rs @@ -46,17 +46,22 @@ pub(super) fn subscript(s: &mut Session, p: &Value) -> Result { } /// A typeface name from `key`: trimmed, and the length `format.fontDialog` allows. +/// +/// Absent, as `opt_usize_param` and `id_param` read an absent key, so a call that leaves a script +/// out keeps that typeface. Present but not a string is refused: `str_param` answers `None` to +/// both, so `{"family": "Lato", "eastAsia": 42}` used to set the Latin typeface, leave the East +/// Asian one alone and report success -- the one thing the caller asked for silently not done +/// (noted in review). fn typeface_param(p: &Value, key: &str) -> Result> { - match str_param(p, key) { - None => Ok(None), - Some(v) => { - let t = v.trim(); - if t.is_empty() || t.chars().count() > 200 { - return Err(bad("format.font", format!("`{key}` must be 1-200 characters"))); - } - Ok(Some(t.to_string())) - } + let v = match p.get(key) { + None | Some(Value::Null) => return Ok(None), + Some(v) => v.as_str().ok_or_else(|| bad("format.font", format!("`{key}` is not a typeface name: {v}")))?, + }; + let t = v.trim(); + if t.is_empty() || t.chars().count() > 200 { + return Err(bad("format.font", format!("`{key}` must be 1-200 characters"))); } + Ok(Some(t.to_string())) } pub(super) fn font(s: &mut Session, p: &Value) -> Result { diff --git a/crates/engine/src/cmd/text.rs b/crates/engine/src/cmd/text.rs index d441e6421..b922bf8d9 100644 --- a/crates/engine/src/cmd/text.rs +++ b/crates/engine/src/cmd/text.rs @@ -254,6 +254,30 @@ mod font_script_tests { for p in [json!({"family": " "}), json!({"family": "Lato", "eastAsia": ""}), json!({"family": "Lato", "complexScript": "x".repeat(201)})] { assert!(s.execute("format.font", &p).is_err(), "{p} should be rejected"); } + + // A script key that is present but not a string is refused, not read as absent. It used + // to set `family` and report success with the script typeface untouched, so the one thing + // the call asked for was the one thing that did not happen (noted in review). + for p in [ + json!({"family": "Lato", "eastAsia": 42}), + json!({"family": "Lato", "complexScript": true}), + json!({"family": "Lato", "eastAsia": ["Noto Sans CJK SC"]}), + json!({"family": "Lato", "complexScript": {"name": "Noto Sans Arabic"}}), + json!({"family": 42}), + ] { + let e = s.execute("format.font", &p).expect_err(&format!("{p} should be rejected")); + assert!(format!("{e}").contains("is not a typeface name"), "{p}: {e}"); + } + // Nothing above changed a run: the first call in this test left `family` unset, and a + // refused call must not have set it on the way to the error. + assert_eq!(typefaces(&mut s), vec![(None, None, None)]); + + // An explicit `null` reads as absent, as it does for an index or a shape id, so the + // script keeps whatever typeface it had. + s.execute("format.font", &json!({"family": "Lato", "eastAsia": "Noto Sans CJK SC"})).unwrap(); + s.execute("format.font", &json!({"family": "Lato", "eastAsia": null})).unwrap(); + assert_eq!(typefaces(&mut s), vec![(Some("Lato".into()), Some("Noto Sans CJK SC".into()), None)]); + // A name with spaces around it is kept, trimmed. s.execute("format.font", &json!({"family": " Lato ", "eastAsia": " Noto Sans CJK SC "})).unwrap(); assert_eq!(typefaces(&mut s), vec![(Some("Lato".into()), Some("Noto Sans CJK SC".into()), None)]); From 4bed9b6c370350cc9e76625e7e3a7d409631beee Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:50:54 +0100 Subject: [PATCH 078/716] Reject unsupported handout perPage values in file.export Found while testing crates/engine/src/cmd/file.rs:362 (pdf_options) with crates/pdf/src/lib.rs:364-371 (handout_boxes) Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/engine/src/cmd/file.rs | 8 +++++++- crates/engine/src/tests.rs | 13 +++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/file.rs b/crates/engine/src/cmd/file.rs index 0d52e6358..dc9f1a44e 100644 --- a/crates/engine/src/cmd/file.rs +++ b/crates/engine/src/cmd/file.rs @@ -359,7 +359,13 @@ pub fn pdf_options(p: &Value, count: usize) -> Result let mut o = deckcraft_pdf::PdfOptions { layout: deckcraft_pdf::PageLayout::Slides, ..Default::default() }; o.layout = match str_param(p, "layout").unwrap_or("slides") { "notes" => deckcraft_pdf::PageLayout::Notes, - "handouts" => deckcraft_pdf::PageLayout::Handouts { per_page: usize_param(p, "perPage").unwrap_or(6).clamp(1, 9) as u8 }, + "handouts" => { + let per_page = usize_param(p, "perPage").unwrap_or(6); + if ![1, 2, 3, 4, 6, 9].contains(&per_page) { + return Err(bad("file.export", format!("perPage {per_page} isn't one of 1, 2, 3, 4, 6, 9"))); + } + deckcraft_pdf::PageLayout::Handouts { per_page: per_page as u8 } + } _ => deckcraft_pdf::PageLayout::Slides, }; o.dpi = f64_or(p, "dpi", o.dpi).clamp(36.0, 600.0); diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 68de13418..e8038c9a2 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -2410,6 +2410,19 @@ fn pdf_options_take_paper_and_orientation() { assert!(cmd::file::pdf_options(&json!({"orientation": "sideways"}), 1).is_err()); } +/// Handout `perPage` accepts only 1, 2, 3, 4, 6 and 9; anything else is an error, not a 9-up page. +#[test] +fn pdf_options_reject_unsupported_per_page() { + for n in [1, 2, 3, 4, 6, 9] { + let o = cmd::file::pdf_options(&json!({"layout": "handouts", "perPage": n}), 1).unwrap(); + assert!(matches!(o.layout, deckcraft_pdf::PageLayout::Handouts { per_page } if per_page as usize == n)); + } + for n in [0, 5, 7, 8, 10] { + let e = cmd::file::pdf_options(&json!({"layout": "handouts", "perPage": n}), 1).unwrap_err(); + assert!(e.to_string().contains("1, 2, 3, 4, 6, 9"), "perPage {n}: {e}"); + } +} + #[test] fn shape_line_sets_compound_and_arrow_sizes() { // The Format Shape pane's Line page: compound type, arrowheads and their sizes. From e0992c132568a26259d686c84c2c804deae201ee Mon Sep 17 00:00:00 2001 From: Naseq Date: Mon, 2 Nov 2026 15:25:31 +0430 Subject: [PATCH 079/716] Transitions: render cached previous slide with completed animation state - Use render_frame with timeline.steps() and t = 0.0 so the previous slide is rendered in its final completed state during transition preview. - Pass duration: 1000 integer ms in test to explicitly test the requested duration. --- crates/ui-egui/src/show/tests.rs | 2 +- crates/ui-egui/src/show/ui.rs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/show/tests.rs b/crates/ui-egui/src/show/tests.rs index 5e39bd18e..c7c34b171 100644 --- a/crates/ui-egui/src/show/tests.rs +++ b/crates/ui-egui/src/show/tests.rs @@ -1245,7 +1245,7 @@ fn a_preview_of_an_edited_presentation_is_rendered_again() { fn transition_preview_plays_from_the_previous_slide() { let mut s = deckcraft_engine::Session::with_new(); s.execute("slide.new", &json!({})).unwrap(); - s.execute("transition.set", &json!({"kind": "push", "index": 1, "duration": 1.0})).unwrap(); + s.execute("transition.set", &json!({"kind": "push", "index": 1, "duration": 1000})).unwrap(); let doc = s.active().unwrap().doc.clone(); let mut show = Show::new(&doc, 1, true, false); show.start_transition_preview(&doc, 10.0); diff --git a/crates/ui-egui/src/show/ui.rs b/crates/ui-egui/src/show/ui.rs index 321f8116d..b02a181bc 100644 --- a/crates/ui-egui/src/show/ui.rs +++ b/crates/ui-egui/src/show/ui.rs @@ -10,7 +10,7 @@ use super::zoom::{ }; use super::{ Align2, BackKey, Click, Color32, CornerRadius, Key, Layer, LinkJump, Pos2, Rect, RenderOpts, Sense, ShapeId, ShapeState, Show, ShowAction, - SlideApp, Source, Stroke, TextureHandle, Ui, json, pos2, show_fills_screen, state_for, theme, vec2, viewport_visible, + ShowState, SlideApp, Source, Stroke, TextureHandle, Ui, json, pos2, show_fills_screen, state_for, theme, vec2, viewport_visible, }; use deckcraft_anim::{StepStamp, TriggerPlay}; use deckcraft_model::Presentation; @@ -394,9 +394,10 @@ fn draw_transition(show: &mut Show, f: &Fr, sl: &Sl, painter: &egui::Painter, te { let threads = if cfg!(target_arch = "wasm32") { 0 } else { std::thread::available_parallelism().map(|n| n.get().min(8) as u16).unwrap_or(0) }; - let opts = RenderOpts { scale: size.0 as f64 / doc.slide_size.width.max(1.0), size: Some(size), threads, ..Default::default() }; - let img = deckcraft_render::render_slide(doc, prev, &opts); - tr.old = Some(crate::textures::upload(ctx, "trans-old", crate::textures::to_color_image(&img, false))); + let timeline = ShowState::timeline(doc, prev); + let step = timeline.steps(); + let ci = render_frame(doc, prev, timeline, step, 0.0, size, vec![], &[], threads, &[], &[], None); + tr.old = Some(crate::textures::upload(ctx, "trans-old", ci)); } let aspect = doc.slide_size.width / doc.slide_size.height.max(1.0); let part = |k: usize| tr.parts.as_ref().and_then(|p| p.get(k).cloned().flatten()); From 370b38e69ad007e115da5b0b8168e23659c05b5d Mon Sep 17 00:00:00 2001 From: Hamza Date: Mon, 2 Nov 2026 15:57:14 +0500 Subject: [PATCH 080/716] A date with no field to keep takes the deck's remembered format My previous commit withheld the format from `set_date` whenever the caller had not named one, so a field the slide already had would not be rewritten. That is right where there is a field. A placeholder showing a fixed date holds plain text and no date field at all, so there was no format to preserve and the withheld format left `date_kind("")` to build a `datetime1`: a slide taken from `datetime11` to fixed text and back came away on the short date (noted in review). The deck's format now always reaches `set_date`, and `format_given` is what decides whether it may rewrite an existing field. With no field, there is nothing to preserve and the remembered format is what a new one takes. `a_fixed_date_turned_automatic_again_comes_back_on_the_remembered_format` walks that transition with no `dateFormat` in the call, which is what the dialog sends, and goes on to assert the guard still holds where a field does exist. It is a test of its own rather than more of `the_automatic_date_takes_the_format_it_is_given`, because setting a format for one slide also moves the deck's global one, which that test's later assertions depend on. --- crates/engine/src/cmd/design/slide_setup.rs | 49 +++++++++++++++++---- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/crates/engine/src/cmd/design/slide_setup.rs b/crates/engine/src/cmd/design/slide_setup.rs index ed91d3253..32534255a 100644 --- a/crates/engine/src/cmd/design/slide_setup.rs +++ b/crates/engine/src/cmd/design/slide_setup.rs @@ -176,12 +176,10 @@ pub(super) fn header_footer(s: &mut Session, p: &Value) -> Result { } (Some(pos), true) if k == PhType::Date && (date_given || format_given) => { if let Some(sh) = sl.shapes.get_mut(pos) { - // Only a format the caller asked for. The dialog always sends - // `dateText`, so an Apply with no format selection reached here and - // rewrote a slide's own `datetime11` field to the deck's global - // format, which the caller never mentioned (noted in review). No - // format means the field keeps the one it has. - set_date(sh, &hf.date_text, if format_given { &hf.date_format } else { "" }); + // The deck's format always travels; whether the caller asked for it + // is what decides if it may rewrite a field the slide already has + // (see `set_date`). + set_date(sh, &hf.date_text, &hf.date_format, format_given); } } _ => {} @@ -205,8 +203,19 @@ fn date_now(format: &str) -> String { } /// Point a slide's date placeholder at a fixed date (its own plain text) or, for an empty -/// `fixed`, at an automatic date field (one it already has keeps its format). -fn set_date(sh: &mut Shape, fixed: &str, format: &str) { +/// `fixed`, at an automatic date field. +/// +/// `format_given` is whether the caller named a format. The dialog always sends `dateText`, so an +/// Apply with no format selection reached here carrying the deck's global format and rewrote a +/// slide's own `datetime11` field to it -- a format the caller never mentioned. A field the slide +/// already has therefore keeps its own format unless one was asked for. +/// +/// That holds only where there *is* a field to keep. A placeholder showing a fixed date has no +/// date field and no format of its own, so clearing `dateText` without naming a format used to +/// build a `datetime1`: a slide that went from `datetime11` to fixed text and back came away on +/// the short date. With nothing to preserve, the deck's remembered format is the right one to +/// take (noted in review). +fn set_date(sh: &mut Shape, fixed: &str, format: &str, format_given: bool) { let runs = || sh.text.iter().flat_map(|t| &t.paragraphs).flat_map(|p| &p.runs); let field_now = runs().find_map(|r| match &r.kind { RunKind::Field { field } if deckcraft_text::datetime::is_date_field(field) => Some(field.clone()), @@ -214,6 +223,7 @@ fn set_date(sh: &mut Shape, fixed: &str, format: &str) { }); let has_field = field_now.is_some(); let props = runs().next().map(|r| r.props.clone()).unwrap_or_default(); + let format = if format_given || !has_field { format } else { "" }; let want = date_kind(format); let (text, kind) = match fixed { // Automatic: keep the field, but follow a format that has changed. @@ -329,6 +339,29 @@ mod header_footer_date_tests { assert_eq!(kinds(&s), vec![Some("datetime2".to_string()); 2], "a format the caller asked for still applies"); } + /// A fixed date is plain text, so the placeholder has no date field and no format of its + /// own. Clearing `dateText` without naming a format therefore has nothing to preserve, and + /// built a `datetime1`: a slide that went from `datetime11` to fixed text and back came away + /// on the short date (noted in review). + #[test] + fn a_fixed_date_turned_automatic_again_comes_back_on_the_remembered_format() { + let mut s = Session::with_new(); + run_automatic(&mut s, json!({"date": true, "dateFormat": "datetime11", "all": true}), "datetime11"); + + s.execute("design.headerFooter", &json!({"date": true, "dateText": "4 July 1776", "all": true})).unwrap(); + assert_eq!(dates(&s), vec![("4 July 1776".to_string(), None)], "fixed: plain text, no field"); + + // No `dateFormat` in this call, which is what the dialog sends on an Apply. + run_automatic(&mut s, json!({"date": true, "dateText": "", "all": true}), "datetime11"); + + // And the guard this must not undo: where there *is* a field, an Apply naming no format + // still leaves the slide's own format alone, although the deck's format now reaches + // `set_date` either way. + s.execute("design.headerFooter", &json!({"date": true, "dateFormat": "datetime5", "all": false})).unwrap(); + s.execute("design.headerFooter", &json!({"date": true, "dateText": "", "all": true})).unwrap(); + assert_eq!(dates(&s)[0].1.as_deref(), Some("datetime5"), "the slide's own format survives"); + } + /// Header & Footer's automatic date takes the format it is given. `HeaderFooter::date_format` /// existed for this and was never read: the placeholder was always `datetime1`, and a /// `dateFormat` parameter was accepted and silently dropped. From 72ac32715ffd5c94de9e6d6b1cfb9bce7ccb65c4 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:21:37 +0100 Subject: [PATCH 081/716] Reject invalid master and layout indices in view.slideMaster Found while testing crates/engine/src/cmd/design/master_view.rs:8 (master_view; `master` read via usize_param, `layout` at :14) Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/engine/src/cmd/design/master_view.rs | 6 +++--- crates/engine/src/tests.rs | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/design/master_view.rs b/crates/engine/src/cmd/design/master_view.rs index 5dfe04964..c03bfa574 100644 --- a/crates/engine/src/cmd/design/master_view.rs +++ b/crates/engine/src/cmd/design/master_view.rs @@ -1,17 +1,17 @@ use super::{ Arc, Fill, NO_ID_SPACE, PhType, Result, Run, RunKind, Session, Shape, ShapeId, Size, Target, TextBody, Value, bad, bool_param, json, - master_index, ok, opt_usize_param, rect_param, str_param, usize_param, + master_index, ok, opt_usize_param, rect_param, str_param, }; pub(super) fn master_view(s: &mut Session, p: &Value) -> Result { let st = s.doc()?; - let mi = usize_param(p, "master").unwrap_or_else(|| master_index(&st.doc, &st.selection)); + let mi = opt_usize_param(p, "master", "view.slideMaster")?.unwrap_or_else(|| master_index(&st.doc, &st.selection)); // A master thumbnail sends `{master}` and means the master itself. `{master, layout}` selects // that layout. With neither key, follow the current slide's layout. let layout = if p.get("master").is_some() && p.get("layout").is_none() { None } else { - usize_param(p, "layout") + opt_usize_param(p, "layout", "view.slideMaster")? .or_else(|| st.current_slide().and_then(|sl| st.doc.masters.get(mi).and_then(|m| m.layouts.iter().position(|l| l.id == sl.layout)))) }; let target = match layout { diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 68de13418..140a88def 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -6458,3 +6458,14 @@ fn master_body_placeholder_format_keeps_per_level_formatting() { assert_eq!((level(&s, 0).run.size, level(&s, 1).run.size), (Some(28.0), Some(24.0))); assert_eq!(shown(&s), vec![Some(28.0), Some(24.0)]); } + +#[test] +fn slide_master_view_rejects_invalid_indices() { + let mut s = Session::with_new(); + for p in [json!({"master": -1}), json!({"master": 0.5}), json!({"master": 0, "layout": -1}), json!({"master": 0, "layout": 1.5})] { + let r = s.execute("view.slideMaster", &p); + assert!(r.is_err(), "invalid index accepted for {p}: {r:?}"); + } + assert!(s.execute("view.slideMaster", &json!({})).is_ok()); + assert!(s.execute("view.slideMaster", &json!({"master": 0})).is_ok()); +} From 77cd617596da9052fb833ed65401aa0afbd4f118 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:37:19 +0100 Subject: [PATCH 082/716] Use a short temp file name in write_file for long file names Found while testing crates/engine/src/io.rs:49 Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/engine/src/io.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/io.rs b/crates/engine/src/io.rs index 7d21bb4b8..38f4de8d2 100644 --- a/crates/engine/src/io.rs +++ b/crates/engine/src/io.rs @@ -41,12 +41,13 @@ pub fn write_file(path: &str, bytes: &[u8]) -> Result<(), String> { Ok(canonical) => canonical, Err(_) => std::path::PathBuf::from(path), }; - let target_str = target_path.to_str().unwrap_or(path); let existing_perms = std::fs::metadata(&target_path).ok().map(|m| m.permissions()); let mut attempts = 0; let (tmp, mut file) = loop { - let tmp = format!("{target_str}.{}.{}.saving", std::process::id(), COUNTER.fetch_add(1, Ordering::Relaxed)); + // A short fixed-size name: appending to the target's name could exceed the file name limit. + let tmp_name = format!(".deckcraft.{}.{}.saving", std::process::id(), COUNTER.fetch_add(1, Ordering::Relaxed)); + let tmp = target_path.with_file_name(tmp_name); match std::fs::OpenOptions::new().write(true).create_new(true).open(&tmp) { Ok(f) => break (tmp, f), Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists && attempts < 16 => attempts += 1, @@ -120,4 +121,18 @@ mod tests { let _ = std::fs::remove_file(&test_file); let _ = std::fs::remove_dir(&tmp_dir); } + + #[test] + fn write_file_overwrites_file_with_name_near_the_length_limit() { + let dir = std::env::temp_dir().join("deckcraft_io_long_name_test"); + let _ = std::fs::create_dir_all(&dir); + let file = dir.join(format!("{}.pptx", "a".repeat(250))); + std::fs::write(&file, b"old").unwrap(); + let path_str = file.to_str().unwrap(); + + write_file(path_str, b"new").unwrap(); + assert_eq!(read_file(path_str).unwrap(), b"new"); + + let _ = std::fs::remove_file(&file); + } } From 62ada3ab9a00f9fc5724ded9814745b69b3d80ec Mon Sep 17 00:00:00 2001 From: Leonardo Date: Mon, 2 Nov 2026 16:29:41 -0300 Subject: [PATCH 083/716] fix(render): tiled picture fills keep their size in scaled groups and upright tiles A tiled picture fill (a:blipFill with a:tile) was sized in the shape's own units. Inside a group whose child space differs from its box (old decks write child spaces ~1800 times smaller) one tile covered hundreds of boxes, so the fill showed a single flat texel instead of the texture. PowerPoint's own PNG export of a synthetic probe deck shows the tile keeps its size, offset, anchor and mirroring in slide points whatever the group's scale, uniform or stretched unevenly, nested or flipped. The tile is now converted from points to shape units per axis (Renderer::per_point_xy, paint:: tiled_per_point), and snapped to whole device pixels per axis. Tiles with rotWithShape="0" are drawn in device pixels and were sized in pixels, ignoring the zoom (even outside groups); they are now sized to pixels first. Tests: a tile in groups of seven scales (uniform and uneven, wide and tall tile), and an upright tile in a turned shape at zoom 1 and 2. Co-Authored-By: Claude Sonnet 5.5 --- ROADMAP.md | 2 + crates/render/src/paint.rs | 31 ++++++++-- crates/render/src/renderer.rs | 21 +++++-- crates/render/src/tests_wild.rs | 100 ++++++++++++++++++++++++++++++++ 4 files changed, 146 insertions(+), 8 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index ecf27f318..2b472291e 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -148,6 +148,7 @@ app's JSON control channel (`deckcraft --control PORT`). | Date | What landed | |---|---| +| 2026-11-02 | Tiled picture fills in groups: a tile (`a:blipFill` with `a:tile`) keeps its size, offset and anchor in slide points whatever the group's child-coordinate scale, uniform or stretched unevenly, nested or flipped, and tiles with `rotWithShape="0"` keep their size in points at any zoom, as PowerPoint draws them (measured on its own PNG export of a synthetic probe deck: every grouped case within ~3/255 of the ungrouped control's own difference from PowerPoint, which is ~13/255 from resampling). Before, a group whose child space was ~1800 times smaller than its box showed one flat texel of the texture (a Venn diagram with paper-textured circles and a hatched intersection) | | 2026-10-31 | No Fill shape interiors allow selection and editing of underlying objects, even when a quick style remains; hit-testing uses the renderer’s fill resolution. Outlines, rotation, text targets and actual fills keep their hit behaviour (#1621) | | 2026-10-30 | Print-preview tests use the URL emitted by egui and its exact file path; previews are explicitly removed before the macOS process exits | | 2026-10-30 | `slide.actions` lists shape click and hover actions and text-run hyperlinks (including table cells and grouped shapes) for audit; listing never runs an action. The UI pane is a follow-up | @@ -319,6 +320,7 @@ app's JSON control channel (`deckcraft --control PORT`). | Date | Change | Summary | |---|---|---| +| 2026-11-02 | trivial | Progress log: tiled picture fills keep their size in scaled groups. Scores and milestone names unchanged | | 2026-10-31 | trivial | No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged | | 2026-10-30 | trivial | Progress log: read-only slide action inspection; parity scores unchanged | | 2026-10-29 | trivial | Progress log: going back in the slide show reverses the left slide's transition (#1531). Scores and milestone names unchanged | diff --git a/crates/render/src/paint.rs b/crates/render/src/paint.rs index ee572fd98..3c4b1db54 100644 --- a/crates/render/src/paint.rs +++ b/crates/render/src/paint.rs @@ -91,7 +91,10 @@ pub fn fill_path( let on_path = m * path.clone(); ctx.set_transform(Affine::IDENTITY); ctx.push_clip_layer(&on_path); - picture(ctx, pres, &resolved(rctx, pf, ph), on_slide, Affine::IDENTITY, None); + // Drawn in device pixels, so a tile (given in shape units) is sized to pixels first. + let tiled = tiled_per_point(fill, (c[0].hypot(c[1]), c[2].hypot(c[3]))); + let upright = if let Fill::Picture(p) = tiled.as_ref() { p } else { pf }; + picture(ctx, pres, &resolved(rctx, upright, ph), on_slide, Affine::IDENTITY, None); ctx.pop_layer(); return; } @@ -226,9 +229,12 @@ pub fn picture(ctx: &mut RenderContext, pres: &Presentation, pf: &PictureFill, b } let (nw, nh) = images::natural_size(&item.data).unwrap_or((iw, ih)); // PowerPoint draws the tile at a whole number of output pixels. - let k = px_scale.max(1e-9); - let snap = |v: f64| (v * k).round().max(1.0) / k; - let (tile_w, tile_h) = (snap(nw * 0.75 * sx), snap(nh * 0.75 * sy)); + // Per axis: a group can stretch its child space unevenly, and a pixel is then a different + // number of shape units across and down. + let c = m.as_coeffs(); + let (kx, ky) = (c[0].hypot(c[1]).max(1e-9), c[2].hypot(c[3]).max(1e-9)); + let snap = |v: f64, k: f64| (v * k).round().max(1.0) / k; + let (tile_w, tile_h) = (snap(nw * 0.75 * sx, kx), snap(nh * 0.75 * sy, ky)); if !(tile_w > 1e-6 && tile_h > 1e-6 && tile_w.is_finite() && tile_h.is_finite()) { return; } @@ -260,6 +266,23 @@ pub fn picture(ctx: &mut RenderContext, pres: &Presentation, pf: &PictureFill, b draw_image(ctx, &image, iw, ih, dest, m, alpha); } +/// `fill`, with a tiled picture's tile size and offset moved from points to shape units, given +/// the shape units to the point along x and y. A group's child coordinates scale its shapes' +/// boxes (a group can stretch them unevenly), but a tile keeps its size on the slide as PowerPoint +/// draws it, so in a group with a legacy child space the tile would otherwise cover hundreds of +/// boxes and the fill show one flat texel. Anything but a tiled picture, or a unit scale, is +/// returned as it is. +pub fn tiled_per_point(fill: &Fill, per_point: (f64, f64)) -> std::borrow::Cow<'_, Fill> { + let Fill::Picture(pf) = fill else { return std::borrow::Cow::Borrowed(fill) }; + let PictureMode::Tile { tx, ty, sx, sy, flip, align } = &pf.mode else { return std::borrow::Cow::Borrowed(fill) }; + let (kx, ky) = per_point; + if !(kx.is_finite() && ky.is_finite() && kx > 1e-12 && ky > 1e-12) || ((kx - 1.0).abs() < 1e-9 && (ky - 1.0).abs() < 1e-9) { + return std::borrow::Cow::Borrowed(fill); + } + let mode = PictureMode::Tile { tx: tx * kx, ty: ty * ky, sx: sx * kx, sy: sy * ky, flip: flip.clone(), align: align.clone() }; + std::borrow::Cow::Owned(Fill::Picture(PictureFill { mode, ..pf.clone() })) +} + /// Where the first tile of a tiled picture fill goes in `bounds`: its corner, edge middle or /// centre named by `align` (`tl`, `t`, `tr`, `l`, `ctr`, `r`, `bl`, `b`, `br`) on the same point /// of the box, then moved by the offset (points). diff --git a/crates/render/src/renderer.rs b/crates/render/src/renderer.rs index c25f6bab6..916f508e6 100644 --- a/crates/render/src/renderer.rs +++ b/crates/render/src/renderer.rs @@ -346,6 +346,14 @@ impl Renderer { if k.is_finite() && k > 1e-12 { 1.0 / k } else { 1.0 } } + /// [`Renderer::per_point`] along the shape's own x and y axes: a group can stretch its child + /// space unevenly, and a tiled fill keeps its size in points on the slide on both axes. + fn per_point_xy(&self, m: Affine, depth: usize) -> (f64, f64) { + let c = self.line_space(m, depth).1.as_coeffs(); + let inv = |s: f64| if s.is_finite() && s > 1e-12 { 1.0 / s } else { 1.0 }; + (inv(c[0].hypot(c[1])), inv(c[2].hypot(c[3]))) + } + /// The size and transform a shape's text is set in: inside a group whose child coordinates /// scale the shape, the shape's size in slide points and `m` with that scale taken out, so /// insets and font sizes stay in points; otherwise `w`, `h` and `m` themselves. @@ -541,6 +549,7 @@ impl Renderer { geo: &Geometry, (w, h): (f64, f64), m: Affine, + per_point: (f64, f64), fade: &dyn Fn(usize) -> deckcraft_geom::morph::Fade, ) { for (i, sp) in geo.paths.iter().enumerate() { @@ -566,7 +575,10 @@ impl Renderer { paint::fill_path(ctx, rctx, gf, None, &path, *gbox, *gm, sp.fill, fade(i).fill, f.pres); } } - _ => paint::fill_path(ctx, rctx, fl, fill_ph, &sp.path, Rect::new(0.0, 0.0, w, h), m, sp.fill, fade(i).fill, f.pres), + _ => { + let fl = paint::tiled_per_point(fl, per_point); + paint::fill_path(ctx, rctx, &fl, fill_ph, &sp.path, Rect::new(0.0, 0.0, w, h), m, sp.fill, fade(i).fill, f.pres) + } } ctx.set_fill_rule(peniko::Fill::NonZero); } @@ -736,6 +748,7 @@ impl Renderer { let fill = &d.fill; let outline = &d.outline; let fade = |i: usize| d.fade(i); + let pt_xy = self.per_point_xy(m, d.depth); // Fill. match &s.kind { ShapeKind::Picture { fill: pf } => { @@ -744,7 +757,7 @@ impl Renderer { if s.fill.as_ref().is_some_and(|f| !f.is_none()) && let Some(fl) = &fill { - self.fill_geometry(ctx, f, rctx, fl, fill_ph, geo, (w, h), m, &fade); + self.fill_geometry(ctx, f, rctx, fl, fill_ph, geo, (w, h), m, pt_xy, &fade); } ctx.set_transform(m); let bounds = Rect::new(0.0, 0.0, w, h); @@ -761,7 +774,7 @@ impl Renderer { if s.fill.as_ref().is_some_and(|f| !f.is_none()) && let Some(fl) = &fill { - self.fill_geometry(ctx, f, rctx, fl, fill_ph, geo, (w, h), m, &fade); + self.fill_geometry(ctx, f, rctx, fl, fill_ph, geo, (w, h), m, pt_xy, &fade); } ctx.set_transform(m); let pf = deckcraft_model::style::PictureFill { media: *media, ..Default::default() }; @@ -787,7 +800,7 @@ impl Renderer { if let Some(fl) = &fill && !(empty_ph && f.opts.edit && s.fill.is_none() && s.line.is_none() && s.style.is_none()) { - self.fill_geometry(ctx, f, rctx, fl, fill_ph, geo, (w, h), m, &fade); + self.fill_geometry(ctx, f, rctx, fl, fill_ph, geo, (w, h), m, pt_xy, &fade); } } } diff --git a/crates/render/src/tests_wild.rs b/crates/render/src/tests_wild.rs index ae78f64b1..96a546f0c 100644 --- a/crates/render/src/tests_wild.rs +++ b/crates/render/src/tests_wild.rs @@ -454,6 +454,106 @@ fn tiled_pictures_flip_align_and_skip_non_positive_scales() { assert!(close(img.pixel(115, 115), WHITE, 5) && close(img.pixel(300, 150), WHITE, 5)); } +#[allow(clippy::unwrap_used)] +fn red_over_blue() -> Vec { + let img = image::RgbImage::from_fn(4, 8, |_, y| if y < 4 { image::Rgb([255, 0, 0]) } else { image::Rgb([0, 0, 255]) }); + let mut out = std::io::Cursor::new(vec![]); + image::DynamicImage::ImageRgb8(img).write_to(&mut out, image::ImageFormat::Png).unwrap(); + out.into_inner() +} + +#[test] +fn a_tile_keeps_its_size_in_a_group_with_scaled_child_coordinates() { + use deckcraft_model::style::{PictureFill, PictureMode}; + // A group's child space scales its shapes' boxes, not the tile: the same tiles show whether + // the group's child space is 1600 times smaller (old decks write them so), 4 times larger, + // the slide's own or stretched unevenly (PowerPoint draws all of them alike, measured on its + // own export of a probe deck). Before, one tile covered hundreds of boxes and the fill was one + // flat texel, and an uneven group stretched the tile. + // Wide: 8x4 px = 6x3 pt, ten times = 60x30 pt tiles, red then blue across. + // Tall: 4x8 px = 3x6 pt, ten times = 30x60 pt tiles, red over blue down. + let blue = Rgba::rgb(0, 0, 255); + let scales = [(1.0, 1.0), (1600.0, 1600.0), (0.25, 0.25), (2.0, 0.5), (0.5, 2.0), (1800.0, 1.0), (1.0, 1800.0)]; + for (kx, ky) in scales { + for tall in [false, true] { + let mut p = Presentation::default(); + let png = if tall { red_over_blue() } else { half_red_half_blue() }; + let media = p.add_media("t.png", "image/png", png).expect("media"); + let mode = PictureMode::Tile { tx: 0.0, ty: 0.0, sx: 10.0, sy: 10.0, flip: "none".into(), align: "tl".into() }; + let member = Shape { + id: ShapeId(22), + xfrm: Some(Xfrm::new(0.0, 0.0, 240.0 / kx, 60.0 / ky)), + fill: Some(Fill::Picture(PictureFill { media, mode, ..Default::default() })), + line: no_line(), + ..Default::default() + }; + let group = Shape { + id: ShapeId(21), + xfrm: Some(Xfrm::new(100.0, 100.0, 240.0, 60.0)), + kind: ShapeKind::Group { children: vec![member], child: Xfrm::new(0.0, 0.0, 240.0 / kx, 60.0 / ky) }, + ..Default::default() + }; + std::sync::Arc::make_mut(&mut p.slides[0]).shapes = vec![group]; + let img = render_slide(&p, 0, &RenderOpts { scale: 1.0, ..Default::default() }); + // Along the tile's long side: first half red, second blue, then red again. + let (a, b, c) = if tall { ((115, 115), (115, 145), (115, 175)) } else { ((115, 115), (145, 115), (175, 115)) }; + let (pa, pb, pc) = (img.pixel(a.0, a.1), img.pixel(b.0, b.1), img.pixel(c.0, c.1)); + assert!( + close(pa, RED, 30) && close(pb, blue, 30) && (tall || close(pc, RED, 30)) && (!tall || close(pc, WHITE, 5) || close(pc, RED, 30)), + "child space {kx} x {ky}, tall={tall}: {pa:?} {pb:?} {pc:?}" + ); + } + } +} + +#[test] +fn an_upright_tile_in_a_turned_shape_keeps_its_size_in_points_at_any_zoom() { + use deckcraft_model::style::{PictureFill, PictureMode}; + // `rotWithShape="0"` draws the tiles on the slide's axes, in device pixels: they were sized in + // pixels, so zooming (or a group's child scale) changed their size on the slide. PowerPoint's + // export of the same shapes shows 60x30 pt tiles at every zoom. + let draw = |scale: f64, group: f64| { + let mut p = Presentation::default(); + let media = p.add_media("t.png", "image/png", half_red_half_blue()).expect("media"); + let mode = PictureMode::Tile { tx: 0.0, ty: 0.0, sx: 10.0, sy: 10.0, flip: "none".into(), align: "tl".into() }; + let fill = Fill::Picture(PictureFill { media, mode, upright: true, ..Default::default() }); + let shape = Shape { + id: ShapeId(22), + xfrm: Some(Xfrm { rot: 20.0, ..Xfrm::new(0.0, 0.0, 240.0 / group, 120.0 / group) }), + fill: Some(fill), + line: no_line(), + ..Default::default() + }; + let shape = if group == 1.0 { + Shape { xfrm: Some(Xfrm { rot: 20.0, ..Xfrm::new(100.0, 100.0, 240.0, 120.0) }), ..shape } + } else { + Shape { + id: ShapeId(21), + xfrm: Some(Xfrm::new(100.0, 100.0, 240.0, 120.0)), + kind: ShapeKind::Group { children: vec![shape], child: Xfrm::new(0.0, 0.0, 240.0 / group, 120.0 / group) }, + ..Default::default() + } + }; + std::sync::Arc::make_mut(&mut p.slides[0]).shapes = vec![shape]; + render_slide(&p, 0, &RenderOpts { scale, ..Default::default() }) + }; + for group in [1.0, 0.25] { + let (one, two) = (draw(1.0, group), draw(2.0, group)); + let (mut same, mut total) = (0, 0); + for y in (120..220).step_by(7) { + for x in (120..320).step_by(9) { + let (a, b) = (one.pixel(x, y), two.pixel(2 * x, 2 * y)); + if close(a, WHITE, 5) && close(b, WHITE, 5) { + continue; // outside the turned rectangle + } + total += 1; + same += usize::from(close(a, Rgba::rgb(b[0], b[1], b[2]), 40)); + } + } + assert!(total > 40 && same * 10 >= total * 9, "group scale {group}: {same} of {total} samples agree between zoom 1 and 2"); + } +} + #[test] fn a_tiles_first_copy_sits_on_the_point_its_alignment_names() { let b = Rect::new(0.0, 0.0, 100.0, 50.0); From 5cb6ba8403a0d1598c59c83e9fd5c83a227a29ee Mon Sep 17 00:00:00 2001 From: Luis <43929895+Luis-0508@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:03:34 +0100 Subject: [PATCH 084/716] Comments: the pane keeps its width and resizes again (fixes #1431) A comment card's reply row reserved a fixed 70 px for its Resolve and delete buttons, which need more. The row overflowed the card, the pane grew by the overflow every frame until it stuck at its widest, and dragging its edge no longer changed it. The buttons are now laid out first, from the right, and the reply field takes the width they leave. --- crates/ui-egui/src/panels/comments.rs | 47 +++++++++++++++------------ crates/ui-egui/src/tests.rs | 44 +++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 21 deletions(-) diff --git a/crates/ui-egui/src/panels/comments.rs b/crates/ui-egui/src/panels/comments.rs index edf0e8b84..5acb71402 100644 --- a/crates/ui-egui/src/panels/comments.rs +++ b/crates/ui-egui/src/panels/comments.rs @@ -130,29 +130,34 @@ fn comment_card(app: &mut SlideApp, ui: &mut Ui, slide: usize, index: usize, c: for r in &c.replies { ui.label(egui::RichText::new(format!("↳ {}: {}", r.author, r.text)).color(t.text_dim)); } + // The buttons are laid out first, from the right, so the reply field takes exactly the + // width they leave. A fixed allowance overflowed the card and widened the pane every + // frame until it stuck at its widest (#1431). ui.horizontal(|ui| { - let id = ui.scope_id().with(("reply", slide, index)); - let mut txt: String = ui.data_mut(|d| d.get_temp(id).unwrap_or_default()); - let r = ui.add(egui::TextEdit::singleline(&mut txt).hint_text("Reply…").desired_width(ui.available_width() - 70.0)); - if r.lost_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter)) && !txt.trim().is_empty() { - focus_comment(app, slide, index); - run(app, "comment.reply", json!({"index": index, "text": txt})); - txt.clear(); - } - ui.data_mut(|d| d.insert_temp(id, txt)); - if ui.small_button(if c.resolved { "Reopen" } else { "Resolve" }).clicked() { - focus_comment(app, slide, index); - run(app, "comment.resolve", json!({"index": index, "resolved": !c.resolved})); - } - if ui.small_button("🗑").clicked() { - let _ = app.run("slide.go", json!({"index": slide})); - let _ = app.run("comment.delete", json!({"index": index})); - match app.ui.comment_focus { - Some((fs, fi)) if fs == slide && fi == index => app.ui.comment_focus = None, - Some((fs, fi)) if fs == slide && fi > index => app.ui.comment_focus = Some((fs, fi - 1)), - _ => {} + ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { + if ui.small_button("🗑").clicked() { + let _ = app.run("slide.go", json!({"index": slide})); + let _ = app.run("comment.delete", json!({"index": index})); + match app.ui.comment_focus { + Some((fs, fi)) if fs == slide && fi == index => app.ui.comment_focus = None, + Some((fs, fi)) if fs == slide && fi > index => app.ui.comment_focus = Some((fs, fi - 1)), + _ => {} + } } - } + if ui.small_button(if c.resolved { "Reopen" } else { "Resolve" }).clicked() { + focus_comment(app, slide, index); + run(app, "comment.resolve", json!({"index": index, "resolved": !c.resolved})); + } + let id = ui.scope_id().with(("reply", slide, index)); + let mut txt: String = ui.data_mut(|d| d.get_temp(id).unwrap_or_default()); + let r = ui.add(egui::TextEdit::singleline(&mut txt).hint_text("Reply…").desired_width(ui.available_width())); + if r.lost_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter)) && !txt.trim().is_empty() { + focus_comment(app, slide, index); + run(app, "comment.reply", json!({"index": index, "text": txt})); + txt.clear(); + } + ui.data_mut(|d| d.insert_temp(id, txt)); + }); }); }); if focused { diff --git a/crates/ui-egui/src/tests.rs b/crates/ui-egui/src/tests.rs index 29fa755fd..5221544a1 100644 --- a/crates/ui-egui/src/tests.rs +++ b/crates/ui-egui/src/tests.rs @@ -2361,3 +2361,47 @@ fn overdue_visible_logic_does_not_reanchor_a_later_hidden_show() { let _ = ctx.run_logic(&raw_at(12.0, true, false), |ctx| app.tick_hidden_show(ctx, visible_anchor + std::time::Duration::from_secs(3))); assert_eq!(app.show.as_ref().unwrap().state.slide, 1, "time from the full visible frame is preserved through the logic-only pass"); } + +/// #1431: a comment card's reply row was wider than the pane, so the Comments pane grew every +/// frame until it stuck at its widest and dragging its edge did nothing. +#[test] +fn comments_pane_keeps_its_width_and_resizes() { + let mut h = egui_kittest::Harness::builder().with_size(egui::vec2(1200.0, 800.0)).build_ui_state( + |ui, app: &mut SlideApp| { + app.logic(ui.ctx()); + app.ui(ui); + }, + SlideApp::new(Session::with_new(), Services::default()), + ); + h.run_steps(3); + h.state_mut().run("comment.add", json!({"text": "Check the figures on this slide"})).unwrap(); + h.state_mut().run("comment.add", json!({"text": "Resolved one"})).unwrap(); + h.state_mut().run("comment.resolve", json!({"index": 1, "resolved": true})).unwrap(); + h.state_mut().run("view.pane", json!({"pane": "comments"})).unwrap(); + h.run_steps(30); + let width = h.state().ui.pane_width; + assert!(width < 320.0, "the pane keeps its default width, not {width}"); + // The cards stay compact: the second one starts near the top, not below a stretched first. + let second = h.get_by_label("Resolved one").rect(); + assert!(second.top() < 450.0, "the second comment sits near the top, at {second:?}"); + + // Drag the pane's left edge: right narrows it, left widens it. + let drag = |h: &mut egui_kittest::Harness<'_, SlideApp>, dx: f32| { + let start = egui::pos2(1200.0 - h.state().ui.pane_width - 1.0, 500.0); + let end = start + egui::vec2(dx, 0.0); + h.event(egui::Event::PointerMoved(start)); + h.run_steps(1); + h.event(egui::Event::PointerButton { pos: start, button: egui::PointerButton::Primary, pressed: true, modifiers: egui::Modifiers::NONE }); + for i in 1..=6 { + h.event(egui::Event::PointerMoved(start + (end - start) * (i as f32 / 6.0))); + h.run_steps(1); + } + h.event(egui::Event::PointerButton { pos: end, button: egui::PointerButton::Primary, pressed: false, modifiers: egui::Modifiers::NONE }); + h.run_steps(10); + h.state().ui.pane_width + }; + let narrow = drag(&mut h, 50.0); + assert!(narrow < width - 40.0, "dragging right narrows the pane: {width} -> {narrow}"); + let wide = drag(&mut h, -150.0); + assert!(wide > narrow + 140.0, "dragging left widens the pane: {narrow} -> {wide}"); +} From 9e59b5f2238f386a44c0324e3dbb8690d19c7bd3 Mon Sep 17 00:00:00 2001 From: Leonardo Date: Mon, 2 Nov 2026 17:31:10 -0300 Subject: [PATCH 085/716] fix(render): size a group's own tile and a picture shape's own tile in points too Review of #1693 found two more places that drew a tiled picture fill in the shape's own (child-space) units inside a scaled group. A group nested in a scaled group stored its own tiled fill unconverted, so the members that take it (grpFill) got oversized tiles. The owning group now converts the fill with per_point_xy when it stores it, so inheriting members, directly or through a chain of grpFill groups, get the converted tile. A picture shape (p:pic) whose blip fill is a tile passed its own fill straight to paint::picture. It now goes through paint::tiled_picture_per_point, which tiled_per_point also uses. Tests: a group's tile passed to its members and a picture shape's own tile, each in outer groups scaled 1, 0.25, 1600 and 2x0.5; both fail without the change. Docs: the Picture and texture fill checklist row is re-assessed (remains P) with its status line and revision history, and the ROADMAP progress log row mentions both cases. Co-Authored-By: Claude Sonnet 5.5 --- ROADMAP.md | 2 +- crates/render/src/paint.rs | 14 ++++++-- crates/render/src/renderer.rs | 6 ++-- crates/render/src/tests_wild.rs | 62 +++++++++++++++++++++++++++++++++ docs/parity-checklist.md | 5 ++- 5 files changed, 82 insertions(+), 7 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 2b472291e..3a1889a8c 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -148,7 +148,7 @@ app's JSON control channel (`deckcraft --control PORT`). | Date | What landed | |---|---| -| 2026-11-02 | Tiled picture fills in groups: a tile (`a:blipFill` with `a:tile`) keeps its size, offset and anchor in slide points whatever the group's child-coordinate scale, uniform or stretched unevenly, nested or flipped, and tiles with `rotWithShape="0"` keep their size in points at any zoom, as PowerPoint draws them (measured on its own PNG export of a synthetic probe deck: every grouped case within ~3/255 of the ungrouped control's own difference from PowerPoint, which is ~13/255 from resampling). Before, a group whose child space was ~1800 times smaller than its box showed one flat texel of the texture (a Venn diagram with paper-textured circles and a hatched intersection) | +| 2026-11-02 | Tiled picture fills in groups: a tile (`a:blipFill` with `a:tile`) keeps its size, offset and anchor in slide points whatever the group's child-coordinate scale, uniform or stretched unevenly, nested or flipped (also a group's own tile fill passed to its members, and a picture shape's own tile), and tiles with `rotWithShape="0"` keep their size in points at any zoom, as PowerPoint draws them (measured on its own PNG export of a synthetic probe deck: every grouped case within ~3/255 of the ungrouped control's own difference from PowerPoint, which is ~13/255 from resampling). Before, a group whose child space was ~1800 times smaller than its box showed one flat texel of the texture (a Venn diagram with paper-textured circles and a hatched intersection) | | 2026-10-31 | No Fill shape interiors allow selection and editing of underlying objects, even when a quick style remains; hit-testing uses the renderer’s fill resolution. Outlines, rotation, text targets and actual fills keep their hit behaviour (#1621) | | 2026-10-30 | Print-preview tests use the URL emitted by egui and its exact file path; previews are explicitly removed before the macOS process exits | | 2026-10-30 | `slide.actions` lists shape click and hover actions and text-run hyperlinks (including table cells and grouped shapes) for audit; listing never runs an action. The UI pane is a follow-up | diff --git a/crates/render/src/paint.rs b/crates/render/src/paint.rs index 3c4b1db54..74d111236 100644 --- a/crates/render/src/paint.rs +++ b/crates/render/src/paint.rs @@ -274,13 +274,21 @@ pub fn picture(ctx: &mut RenderContext, pres: &Presentation, pf: &PictureFill, b /// returned as it is. pub fn tiled_per_point(fill: &Fill, per_point: (f64, f64)) -> std::borrow::Cow<'_, Fill> { let Fill::Picture(pf) = fill else { return std::borrow::Cow::Borrowed(fill) }; - let PictureMode::Tile { tx, ty, sx, sy, flip, align } = &pf.mode else { return std::borrow::Cow::Borrowed(fill) }; + match tiled_picture_per_point(pf, per_point) { + std::borrow::Cow::Borrowed(_) => std::borrow::Cow::Borrowed(fill), + std::borrow::Cow::Owned(p) => std::borrow::Cow::Owned(Fill::Picture(p)), + } +} + +/// [`tiled_per_point`] for a picture fill itself (a picture shape's own fill is not a [`Fill`]). +pub fn tiled_picture_per_point(pf: &PictureFill, per_point: (f64, f64)) -> std::borrow::Cow<'_, PictureFill> { + let PictureMode::Tile { tx, ty, sx, sy, flip, align } = &pf.mode else { return std::borrow::Cow::Borrowed(pf) }; let (kx, ky) = per_point; if !(kx.is_finite() && ky.is_finite() && kx > 1e-12 && ky > 1e-12) || ((kx - 1.0).abs() < 1e-9 && (ky - 1.0).abs() < 1e-9) { - return std::borrow::Cow::Borrowed(fill); + return std::borrow::Cow::Borrowed(pf); } let mode = PictureMode::Tile { tx: tx * kx, ty: ty * ky, sx: sx * kx, sy: sy * ky, flip: flip.clone(), align: align.clone() }; - std::borrow::Cow::Owned(Fill::Picture(PictureFill { mode, ..pf.clone() })) + std::borrow::Cow::Owned(PictureFill { mode, ..pf.clone() }) } /// Where the first tile of a tiled picture fill goes in `bounds`: its corner, edge middle or diff --git a/crates/render/src/renderer.rs b/crates/render/src/renderer.rs index 916f508e6..699a938f2 100644 --- a/crates/render/src/renderer.rs +++ b/crates/render/src/renderer.rs @@ -436,7 +436,8 @@ impl Renderer { // A group's own fill (a group filled with its parent's passes that on). let own = match &s.fill { Some(Fill::Group) | None => self.group_fill.clone(), - Some(fl) => Some((fl.clone(), m, Rect::new(0.0, 0.0, x.w, x.h))), + // A tile is given in points; this group's own space may be scaled by its parents. + Some(fl) => Some((paint::tiled_per_point(fl, self.per_point_xy(m, depth)).into_owned(), m, Rect::new(0.0, 0.0, x.w, x.h))), }; let outer = std::mem::replace(&mut self.group_fill, own); // A group's outer shadow is cast by everything in it, as PowerPoint draws it: the @@ -763,7 +764,8 @@ impl Renderer { let bounds = Rect::new(0.0, 0.0, w, h); ctx.push_clip_layer(outline); let t = f.opts.gif_times.iter().find(|g| g.0 == s.id).map(|g| g.1); - paint::picture(ctx, f.pres, &paint::resolved(rctx, pf, None), bounds, m, t); + let pf = paint::tiled_picture_per_point(pf, pt_xy); + paint::picture(ctx, f.pres, &paint::resolved(rctx, &pf, None), bounds, m, t); ctx.pop_layer(); } // An object DeckCraft doesn't model (an embedded OLE object, an unknown graphic): its diff --git a/crates/render/src/tests_wild.rs b/crates/render/src/tests_wild.rs index 96a546f0c..c81e481c5 100644 --- a/crates/render/src/tests_wild.rs +++ b/crates/render/src/tests_wild.rs @@ -506,6 +506,68 @@ fn a_tile_keeps_its_size_in_a_group_with_scaled_child_coordinates() { } } +/// A slide with `shape` (built for a box of `w` x `h` child units) in a group at (100, 100) that is +/// 240 x 60 pt on the slide and scaled `kx` x `ky` against its child space, drawn at 1 px per point. +fn in_a_scaled_group(kx: f64, ky: f64, p: Presentation, shape: impl FnOnce(f64, f64) -> Shape) -> Image { + let (w, h) = (240.0 / kx, 60.0 / ky); + let group = Shape { + id: ShapeId(21), + xfrm: Some(Xfrm::new(100.0, 100.0, 240.0, 60.0)), + kind: ShapeKind::Group { children: vec![shape(w, h)], child: Xfrm::new(0.0, 0.0, w, h) }, + ..Default::default() + }; + let mut p = p; + std::sync::Arc::make_mut(&mut p.slides[0]).shapes = vec![group]; + render_slide(&p, 0, &RenderOpts { scale: 1.0, ..Default::default() }) +} + +#[test] +fn a_tile_a_group_passes_to_its_members_keeps_its_size_inside_a_scaled_group() { + use deckcraft_model::style::{PictureFill, PictureMode}; + // The group that owns the tiled fill sits inside another group whose child space is scaled: the + // members that take it (`grpFill`) get tiles of 60 x 30 pt, as with no outer group. + let blue = Rgba::rgb(0, 0, 255); + for (kx, ky) in [(1.0, 1.0), (0.25, 0.25), (1600.0, 1600.0), (2.0, 0.5)] { + let mut p = Presentation::default(); + let media = p.add_media("t.png", "image/png", half_red_half_blue()).expect("media"); + let mode = PictureMode::Tile { tx: 0.0, ty: 0.0, sx: 10.0, sy: 10.0, flip: "none".into(), align: "tl".into() }; + let img = in_a_scaled_group(kx, ky, p, |w, h| { + let member = + Shape { id: ShapeId(23), xfrm: Some(Xfrm::new(0.0, 0.0, w, h)), fill: Some(Fill::Group), line: no_line(), ..Default::default() }; + Shape { + id: ShapeId(22), + xfrm: Some(Xfrm::new(0.0, 0.0, w, h)), + fill: Some(Fill::Picture(PictureFill { media, mode, ..Default::default() })), + kind: ShapeKind::Group { children: vec![member], child: Xfrm::new(0.0, 0.0, w, h) }, + ..Default::default() + } + }); + let (a, b, c) = (img.pixel(115, 115), img.pixel(145, 115), img.pixel(175, 115)); + assert!(close(a, RED, 30) && close(b, blue, 30) && close(c, RED, 30), "outer group {kx} x {ky}: {a:?} {b:?} {c:?}"); + } +} + +#[test] +fn a_picture_shapes_own_tile_keeps_its_size_inside_a_scaled_group() { + use deckcraft_model::style::{PictureFill, PictureMode}; + // A picture (`p:pic`) whose blip fill is a tile rather than a stretch. + let blue = Rgba::rgb(0, 0, 255); + for (kx, ky) in [(1.0, 1.0), (0.25, 0.25), (1600.0, 1600.0), (2.0, 0.5)] { + let mut p = Presentation::default(); + let media = p.add_media("t.png", "image/png", half_red_half_blue()).expect("media"); + let mode = PictureMode::Tile { tx: 0.0, ty: 0.0, sx: 10.0, sy: 10.0, flip: "none".into(), align: "tl".into() }; + let img = in_a_scaled_group(kx, ky, p, |w, h| Shape { + id: ShapeId(22), + xfrm: Some(Xfrm::new(0.0, 0.0, w, h)), + kind: ShapeKind::Picture { fill: PictureFill { media, mode, ..Default::default() } }, + line: no_line(), + ..Default::default() + }); + let (a, b, c) = (img.pixel(115, 115), img.pixel(145, 115), img.pixel(175, 115)); + assert!(close(a, RED, 30) && close(b, blue, 30) && close(c, RED, 30), "group {kx} x {ky}: {a:?} {b:?} {c:?}"); + } +} + #[test] fn an_upright_tile_in_a_turned_shape_keeps_its_size_in_points_at_any_zoom() { use deckcraft_model::style::{PictureFill, PictureMode}; diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index 606f1228d..8af3745ea 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -2,7 +2,9 @@ > **Generated:** 2026-10-14 (bullets/numbering remain D after empty-line marker review; summary by `cargo xtask parity`; rows re-scored by the 2026-10-14 community PR wave, duplicate Thesaurus, AutoCorrect, Artistic effects and Corrections rows folded; Preview in editor re-scored 2026-10-13; earlier rows re-scored 2026-10-10 against PowerPoint for Mac 16.113.4; video/animated GIF row re-scored 2026-10-11, #171) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) -> **Last updated:** 2026-11-01 · Locked-shape and no-outline regressions added for #1621; fill row re-assessed: remains D; No Fill hit-testing now follows resolved appearance. Scores unchanged. +> **Last updated:** 2026-11-02 · Tiled picture fills keep their size in scaled groups and upright tiles (#1693); Picture and texture fill row re-assessed: remains P, since only how tiles are sized changed. Scores unchanged. +> +> **Previously (2026-11-01):** Locked-shape and no-outline regressions added for #1621; fill row re-assessed: remains D; No Fill hit-testing now follows resolved appearance. Scores unchanged. The summary between ` **Weighted breadth parity: 84%** over 191 features. @@ -240,4 +242,5 @@ Open P0 items: Contextual tabs (Shape Format, Picture Format, Table Design/Layou | Date | Change | Summary | |---|---|---| +| 2026-11-02 | trivial | Tiled picture fills keep their size in scaled groups and upright tiles (#1693); Picture and texture fill row remains P and summary scores are unchanged | | 2026-10-31 | trivial | No Fill interior hit-testing follows resolved fill (#1621); fill row remains D and summary scores are unchanged | From e90e7f6c03afbf7a3694e88521aff6be5df53ba0 Mon Sep 17 00:00:00 2001 From: Leonardo Date: Mon, 2 Nov 2026 17:46:33 -0300 Subject: [PATCH 086/716] fix(render): size the tile of a picture's shadow and reflection in points too Review of #1693 found that cast_effects built the picture content that a shadow, a glow and a reflection are drawn from without converting a tiled fill to points, so inside a scaled group the reflection of a tiled picture showed child-space tiles while its face showed the right ones. The content now goes through paint::tiled_picture_per_point with per_point_xy, as the face does. Test: a tiled picture's reflection in groups scaled 0.25, 1600 and 2x0.5 shows the same colours as in an unscaled group; it fails without the change. Co-Authored-By: Claude Sonnet 5.5 --- ROADMAP.md | 2 +- crates/render/src/renderer.rs | 8 ++++++-- crates/render/src/tests_wild.rs | 30 ++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 3a1889a8c..050c3958b 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -148,7 +148,7 @@ app's JSON control channel (`deckcraft --control PORT`). | Date | What landed | |---|---| -| 2026-11-02 | Tiled picture fills in groups: a tile (`a:blipFill` with `a:tile`) keeps its size, offset and anchor in slide points whatever the group's child-coordinate scale, uniform or stretched unevenly, nested or flipped (also a group's own tile fill passed to its members, and a picture shape's own tile), and tiles with `rotWithShape="0"` keep their size in points at any zoom, as PowerPoint draws them (measured on its own PNG export of a synthetic probe deck: every grouped case within ~3/255 of the ungrouped control's own difference from PowerPoint, which is ~13/255 from resampling). Before, a group whose child space was ~1800 times smaller than its box showed one flat texel of the texture (a Venn diagram with paper-textured circles and a hatched intersection) | +| 2026-11-02 | Tiled picture fills in groups: a tile (`a:blipFill` with `a:tile`) keeps its size, offset and anchor in slide points whatever the group's child-coordinate scale, uniform or stretched unevenly, nested or flipped (also a group's own tile fill passed to its members, and a picture shape's own tile, with its shadow and reflection), and tiles with `rotWithShape="0"` keep their size in points at any zoom, as PowerPoint draws them (measured on its own PNG export of a synthetic probe deck: every grouped case within ~3/255 of the ungrouped control's own difference from PowerPoint, which is ~13/255 from resampling). Before, a group whose child space was ~1800 times smaller than its box showed one flat texel of the texture (a Venn diagram with paper-textured circles and a hatched intersection) | | 2026-10-31 | No Fill shape interiors allow selection and editing of underlying objects, even when a quick style remains; hit-testing uses the renderer’s fill resolution. Outlines, rotation, text targets and actual fills keep their hit behaviour (#1621) | | 2026-10-30 | Print-preview tests use the URL emitted by egui and its exact file path; previews are explicitly removed before the macOS process exits | | 2026-10-30 | `slide.actions` lists shape click and hover actions and text-run hyperlinks (including table cells and grouped shapes) for audit; listing never runs an action. The UI pane is a follow-up | diff --git a/crates/render/src/renderer.rs b/crates/render/src/renderer.rs index 699a938f2..e7cd5ff35 100644 --- a/crates/render/src/renderer.rs +++ b/crates/render/src/renderer.rs @@ -668,9 +668,13 @@ impl Renderer { let line = &d.line; // Effects below the shape. if let Some(e) = &effects { - // A picture (or picture fill) casts its shadow from its pixels, not its frame. + // A picture (or picture fill) casts its shadow from its pixels, not its frame. A tile + // is sized in points on the slide, as the face's is, and so is its shadow and reflection. let content = match (&s.kind, &fill) { - (ShapeKind::Picture { fill: pf }, _) | (_, Some(Fill::Picture(pf))) => Some(paint::resolved(rctx, pf, None).into_owned()), + (ShapeKind::Picture { fill: pf }, _) | (_, Some(Fill::Picture(pf))) => { + let pf = paint::tiled_picture_per_point(pf, self.per_point_xy(m, depth)); + Some(paint::resolved(rctx, &pf, None).into_owned()) + } _ => None, }; // What casts the shadow: the fill as see-through as it is, and the outline. diff --git a/crates/render/src/tests_wild.rs b/crates/render/src/tests_wild.rs index c81e481c5..987781f15 100644 --- a/crates/render/src/tests_wild.rs +++ b/crates/render/src/tests_wild.rs @@ -568,6 +568,36 @@ fn a_picture_shapes_own_tile_keeps_its_size_inside_a_scaled_group() { } } +#[test] +fn a_tiled_pictures_reflection_keeps_the_tile_size_inside_a_scaled_group() { + use deckcraft_model::style::{PictureFill, PictureMode, Reflection}; + // The reflection mirrors the picture's pixels, so its tiles must be the face's, 60 x 30 pt, + // whatever the group's child scale: just below the box it shows the same colours. + let reflected = |kx: f64, ky: f64| { + let mut p = Presentation::default(); + let media = p.add_media("t.png", "image/png", half_red_half_blue()).expect("media"); + let mode = PictureMode::Tile { tx: 0.0, ty: 0.0, sx: 10.0, sy: 10.0, flip: "none".into(), align: "tl".into() }; + let rf = Reflection { blur: 0.0, start_alpha: 1.0, end_alpha: 0.0, end_pos: 0.5, dist: 0.0 }; + let img = in_a_scaled_group(kx, ky, p, |w, h| Shape { + id: ShapeId(22), + xfrm: Some(Xfrm::new(0.0, 0.0, w, h)), + kind: ShapeKind::Picture { fill: PictureFill { media, mode, ..Default::default() } }, + line: no_line(), + effects: Some(deckcraft_model::Effects { reflection: Some(rf), ..Default::default() }), + ..Default::default() + }); + [img.pixel(115, 163), img.pixel(145, 163), img.pixel(175, 163)] + }; + let plain = reflected(1.0, 1.0); + assert!(plain[0][0] > plain[0][2] && plain[1][2] > plain[1][0] && plain[2][0] > plain[2][2], "red, blue, red in the reflection: {plain:?}"); + for (kx, ky) in [(0.25, 0.25), (1600.0, 1600.0), (2.0, 0.5)] { + let got = reflected(kx, ky); + for (g, e) in got.iter().zip(&plain) { + assert!(close(*g, Rgba::rgb(e[0], e[1], e[2]), 40), "child scale {kx} x {ky}: {got:?} against {plain:?}"); + } + } +} + #[test] fn an_upright_tile_in_a_turned_shape_keeps_its_size_in_points_at_any_zoom() { use deckcraft_model::style::{PictureFill, PictureMode}; From f2803102c1abb1cc65681f7a21522b3ba7a125a9 Mon Sep 17 00:00:00 2001 From: Harrison Booth <73434116+Harrison-Booth@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:41:17 -0600 Subject: [PATCH 087/716] Correct animation option labels --- crates/ui-egui/src/ribbon/animations.rs | 37 +++++++++++++++++++------ 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/crates/ui-egui/src/ribbon/animations.rs b/crates/ui-egui/src/ribbon/animations.rs index 6d35afdcb..d43801603 100644 --- a/crates/ui-egui/src/ribbon/animations.rs +++ b/crates/ui-egui/src/ribbon/animations.rs @@ -228,9 +228,12 @@ fn animation_option_label(effect: &str, option: &str) -> String { "rb" => Some("From Bottom-Right"), _ => None, }; - if matches!(effect, "fly" | "flyOut" | "wipe" | "wipeOut" | "peek" | "peekOut") + if matches!(effect, "fly" | "flyOut" | "wipe" | "wipeOut" | "peek" | "peekOut" | "crawl" | "crawlOut") && let Some(label) = direction { + if matches!(effect, "flyOut" | "peekOut" | "crawlOut") { + return label.replacen("From", "To", 1); + } return label.into(); } @@ -245,14 +248,14 @@ fn animation_option_label(effect: &str, option: &str) -> String { ("shape" | "shapeOut", o) if o.ends_with("Out") => format!("{} Out", title_first(shape_option_name(o))), ("wheel" | "wheelOut", "1") => "1 Spoke".into(), ("wheel" | "wheelOut", n) => format!("{n} Spokes"), - ("box" | "boxOut" | "circle" | "diamond", "in") => format!("{} In", title_first(effect.trim_end_matches("Out"))), - ("box" | "boxOut" | "circle" | "diamond", "out") => format!("{} Out", title_first(effect.trim_end_matches("Out"))), + ("box" | "boxOut" | "circle" | "diamond" | "diamondOut", "in") => format!("{} In", title_first(effect.trim_end_matches("Out"))), + ("box" | "boxOut" | "circle" | "diamond" | "diamondOut", "out") => format!("{} Out", title_first(effect.trim_end_matches("Out"))), ("zoom" | "zoomOut", "in") => "Zoom In".into(), ("zoom" | "zoomOut", "out") => "Zoom Out".into(), - (_, "lu") => "From Top-Left".into(), - (_, "ru") => "From Top-Right".into(), - (_, "ld") => "From Bottom-Left".into(), - (_, "rd") => "From Bottom-Right".into(), + ("strips" | "stripsOut", "lu") => "Left Up".into(), + ("strips" | "stripsOut", "ru") => "Right Up".into(), + ("strips" | "stripsOut", "ld") => "Left Down".into(), + ("strips" | "stripsOut", "rd") => "Right Down".into(), (_, "horz") => "Horizontal".into(), (_, "vert") => "Vertical".into(), (_, "across") => "Across".into(), @@ -301,11 +304,29 @@ mod animation_option_label_tests { } } assert_eq!(animation_option_label("fly", "lb"), "From Bottom-Left"); - assert_eq!(animation_option_label("flyOut", "rt"), "From Top-Right"); + assert_eq!(animation_option_label("flyOut", "rt"), "To Top-Right"); + assert_eq!(animation_option_label("flyOut", "b"), "To Bottom"); + assert_eq!(animation_option_label("peekOut", "l"), "To Left"); assert_eq!(animation_option_label("wipe", "b"), "From Bottom"); assert_eq!(animation_option_label("wheel", "1"), "1 Spoke"); assert_eq!(animation_option_label("split", "vertOut"), "Vertical Out"); assert_eq!(animation_option_label("shape", "circleIn"), "Circle In"); assert_eq!(animation_option_label("diamond", "out"), "Diamond Out"); + assert_eq!(animation_option_label("diamondOut", "in"), "Diamond In"); + assert_eq!(animation_option_label("diamondOut", "out"), "Diamond Out"); + assert_eq!(animation_option_label("strips", "lu"), "Left Up"); + assert_eq!(animation_option_label("strips", "ru"), "Right Up"); + assert_eq!(animation_option_label("strips", "ld"), "Left Down"); + assert_eq!(animation_option_label("strips", "rd"), "Right Down"); + assert_eq!(animation_option_label("crawl", "b"), "From Bottom"); + assert_eq!(animation_option_label("crawl", "l"), "From Left"); + assert_eq!(animation_option_label("crawl", "t"), "From Top"); + assert_eq!(animation_option_label("crawl", "r"), "From Right"); + assert_eq!(animation_option_label("crawlOut", "l"), "To Left"); + assert_eq!(animation_option_label("crawlOut", "r"), "To Right"); + assert_eq!(animation_option_label("plus", "in"), "In"); + assert_eq!(animation_option_label("plus", "out"), "Out"); + assert_eq!(animation_option_label("changeFontSize", "increase"), "Increase"); + assert_eq!(animation_option_label("changeFontSize", "decrease"), "Decrease"); } } From 3cfd4c5e6e14bcbda200cb962bc439878aec8d95 Mon Sep 17 00:00:00 2001 From: Harrison Booth <73434116+Harrison-Booth@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:47:58 -0600 Subject: [PATCH 088/716] Parse percentage-form bullet sizes --- crates/pptx/src/read/dml.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/crates/pptx/src/read/dml.rs b/crates/pptx/src/read/dml.rs index 372502018..300773a57 100644 --- a/crates/pptx/src/read/dml.rs +++ b/crates/pptx/src/read/dml.rs @@ -27,6 +27,12 @@ fn bullet_size_points(value: Option<&str>) -> Option { value.and_then(|v| v.trim().parse::().ok()).filter(|v| (100..=400_000).contains(v)).map(|v| v as f64 / 100.0) } +fn bullet_size_percent(value: Option<&str>) -> Option { + let value = value?.trim(); + let (value, scale) = if let Some(value) = value.strip_suffix('%') { (value.trim(), 100.0) } else { (value, 100_000.0) }; + value.parse::().ok().filter(|v| v.is_finite()).map(|v| v / scale) +} + /// 1/60 000 degree → degrees. pub fn ang(e: &El, name: &str) -> Option { e.f64(name).map(|v| v / 60_000.0) @@ -461,7 +467,7 @@ pub fn ppr(imp: &mut Imp, part: &Part, p: &El) -> (Option, ParaProps, Option "buSzPct" => { pp.bullet_size_points = None; pp.bullet_size_follow_text = None; - pp.bullet_size = pct(e, "val").map(|v| v.clamp(0.25, 4.0)); + pp.bullet_size = bullet_size_percent(e.attr("val")).map(|v| v.clamp(0.25, 4.0)); } "buSzPts" => { pp.bullet_size = None; @@ -716,6 +722,14 @@ mod tests { assert_eq!(bullet_size_points(Some("1400")), Some(14.0)); } + #[test] + fn bullet_percentage_size_accepts_numeric_and_percent_forms() { + assert_eq!(bullet_size_percent(Some("100000")), Some(1.0)); + assert_eq!(bullet_size_percent(Some("100%")), Some(1.0)); + assert_eq!(bullet_size_percent(Some(" 125% ")), Some(1.25)); + assert_eq!(bullet_size_percent(Some("invalid")), None); + } + #[test] fn miter_limit_accepts_both_percentage_forms_with_schema_bounds() { assert_eq!(parse_miter_limit("200000"), Some(200_000)); From b9eaaeb23b011b7a1e96568a4101f6d0d3cc13b9 Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Mon, 2 Nov 2026 17:03:02 -0600 Subject: [PATCH 089/716] Test: hidden media controls are written as PowerPoint's p14 extension The round trip now also checks the written presProps.xml: inside p:showPr, the extension uri and p14:showMediaCtrls with its namespace declared on the element; the default writes nothing. Co-Authored-By: Claude Opus 5.5 --- crates/pptx/tests/it/roundtrip.rs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/crates/pptx/tests/it/roundtrip.rs b/crates/pptx/tests/it/roundtrip.rs index c61e6e433..521956a06 100644 --- a/crates/pptx/tests/it/roundtrip.rs +++ b/crates/pptx/tests/it/roundtrip.rs @@ -1970,11 +1970,30 @@ fn default_durations_match_powerpoint() { } } -/// Show media controls is PowerPoint's `p14:showMediaCtrls` extension inside `p:showPr`. +/// Show media controls is PowerPoint's `p14:showMediaCtrls` extension inside `p:showPr`: off is +/// written there, under its extension uri and with the p14 namespace declared on the element; +/// on (the default) writes nothing. #[test] fn hidden_media_controls_survive_save_and_reopen() { + let props = |p: &Presentation| { + let bytes = deckcraft_pptx::export(p).expect("export"); + let mut zip = zip::ZipArchive::new(std::io::Cursor::new(bytes)).expect("zip"); + let mut x = String::new(); + std::io::Read::read_to_string(&mut zip.by_name("ppt/presProps.xml").expect("presProps"), &mut x).expect("read"); + x + }; let mut p = Presentation::default(); p.show.show_media_controls = false; + let xml = props(&p); + let show = xml.split("").next()).expect("p:showPr"); + assert!( + show.contains( + "" + ), + "{xml}" + ); assert!(!round(&p).show.show_media_controls); - assert!(round(&Presentation::default()).show.show_media_controls); + let default = Presentation::default(); + assert!(!props(&default).contains("showMediaCtrls")); + assert!(round(&default).show.show_media_controls); } From d542b35bd4bb8be9a6f3239459ba798300cc474d Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Mon, 2 Nov 2026 17:03:05 -0600 Subject: [PATCH 090/716] Test: picture.adjust and format.paragraph refuse only-null calls and take one key Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/tests.rs | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 953322922..feedb1338 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -6008,6 +6008,43 @@ fn style_commands_given_nothing_to_set_are_refused() { s.execute("format.paragraphDialog", &json!({"special": "hanging", "specialBy": 18})).unwrap(); } +/// A call whose keys are all null sets nothing and is refused like an empty one, changing +/// nothing; one valid key is enough, nulls beside it ignored. +#[test] +fn style_commands_refuse_only_nulls_and_take_one_key() { + let mut png = vec![]; + image::DynamicImage::ImageRgba8(image::RgbaImage::from_pixel(4, 2, image::Rgba([200, 30, 30, 255]))) + .write_to(&mut std::io::Cursor::new(&mut png), image::ImageFormat::Png) + .unwrap(); + let mut s = session(); + let pic = + s.execute("insert.picture", &json!({"data": cmd::base64_encode(&png), "name": "a.png", "rect": [100, 100, 40, 20]})).unwrap()["id"].clone(); + let text = s.execute("insert.textBox", &json!({"text": "Hi", "rect": [50, 300, 200, 100]})).unwrap()["id"].clone(); + let nulls = |keys: &[&str]| serde_json::Value::Object(keys.iter().map(|k| ((*k).to_string(), serde_json::Value::Null)).collect()); + for (cmd, id, keys, one) in [ + ( + "picture.adjust", + &pic, + &["brightness", "contrast", "saturation", "grayscale", "transparency", "reset"][..], + json!({"brightness": 0.3, "contrast": null}), + ), + ( + "format.paragraph", + &text, + &["align", "indentLeft", "indentFirst", "spaceBefore", "spaceAfter", "lineSpacing", "lineSpacingPt"][..], + json!({"align": "center", "spaceBefore": null}), + ), + ] { + s.execute("edit.select", &json!({"ids": [id]})).unwrap(); + let rev = s.doc().unwrap().revision; + let e = s.execute(cmd, &nulls(keys)).unwrap_err().to_string(); + assert!(e.contains("given nothing to set") && e.contains(cmd), "{cmd}: {e}"); + assert_eq!(s.doc().unwrap().revision, rev, "{cmd}: only nulls changed the deck"); + s.execute(cmd, &one).unwrap_or_else(|e| panic!("{cmd} {one}: {e}")); + assert_ne!(s.doc().unwrap().revision, rev, "{cmd}: one key set something"); + } +} + #[test] fn highlight_with_an_invalid_colour_is_rejected_and_keeps_the_highlight() { let mut s = session(); From f68150ee10966d71f187869a1c2e40f06aa2f047 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Mon, 2 Nov 2026 19:02:14 -0500 Subject: [PATCH 091/716] Replace the Account page with About (#1697) * UI: replace Account backstage page with About * UI: stack About columns in narrow windows; keep PowerPoint's Account in parity doc * UI: About review fixes: stack columns below 860pt, Help icon, Credits task; doc headers --- ROADMAP.md | 3 ++ crates/ui-egui/src/backstage.rs | 22 ++++++----- crates/ui-egui/src/backstage/info.rs | 54 ++++++++++++--------------- crates/ui-egui/src/backstage/tests.rs | 43 ++++++++++++++++++++- crates/ui-egui/src/lib.rs | 2 +- docs/ui-parity.md | 9 +++-- 6 files changed, 87 insertions(+), 46 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index ecf27f318..2c8c6571e 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,6 +2,7 @@ **Stage: alpha** · next: beta, ~20 points and ~120–210 h away +> **Last reviewed:** 2026-11-02 · **Last updated:** 2026-11-02 · **Change:** trivial (File › About replaces Account; product links, credits and appearance retained; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-11-01 · **Change:** trivial (locked No Fill and no-outline click-through regression coverage added; No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-30 · **Change:** trivial (progress log: read-only `slide.actions` lists shape and table text actions; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) > **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-27 · **Change:** trivial (progress log: Set Up Slide Show ▸ Keep mouse cursor visible, #1445; stage and scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365) @@ -148,6 +149,7 @@ app's JSON control channel (`deckcraft --control PORT`). | Date | What landed | |---|---| +| 2026-11-02 | File › About replaces the unused Account page, with version, project links, contributor/model credits and appearance preferences | | 2026-10-31 | No Fill shape interiors allow selection and editing of underlying objects, even when a quick style remains; hit-testing uses the renderer’s fill resolution. Outlines, rotation, text targets and actual fills keep their hit behaviour (#1621) | | 2026-10-30 | Print-preview tests use the URL emitted by egui and its exact file path; previews are explicitly removed before the macOS process exits | | 2026-10-30 | `slide.actions` lists shape click and hover actions and text-run hyperlinks (including table cells and grouped shapes) for audit; listing never runs an action. The UI pane is a follow-up | @@ -319,6 +321,7 @@ app's JSON control channel (`deckcraft --control PORT`). | Date | Change | Summary | |---|---|---| +| 2026-11-02 | trivial | File › About replaces Account; product links, credits and appearance retained | | 2026-10-31 | trivial | No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged | | 2026-10-30 | trivial | Progress log: read-only slide action inspection; parity scores unchanged | | 2026-10-29 | trivial | Progress log: going back in the slide show reverses the left slide's transition (#1531). Scores and milestone names unchanged | diff --git a/crates/ui-egui/src/backstage.rs b/crates/ui-egui/src/backstage.rs index 1278e7d8a..0fec08a52 100644 --- a/crates/ui-egui/src/backstage.rs +++ b/crates/ui-egui/src/backstage.rs @@ -2,7 +2,7 @@ //! bar until Esc or the back arrow returns to the presentation. With nothing open it is the start //! screen: PowerPoint's start screen and File › Home are the same page. //! -//! A side menu on the left picks a page (Home, New, Open, Info, Save As, Print, Export, Account); +//! A side menu on the left picks a page (Home, New, Open, Info, Save As, Print, Export, About); //! Save, Close and Options act at once. Every action runs an existing command through //! [`SlideApp::run`] or one of the app's file helpers ([`SlideApp::export_as`], //! [`SlideApp::print_pdf`], [`SlideApp::save_as_dialog`]); the state here is UI-only and never @@ -24,7 +24,7 @@ mod print; pub use files::split_path; use files::{home, new_page, open_page}; -use info::{PROPERTIES, account, commit_props, info, save_as}; +use info::{PROPERTIES, about, commit_props, info, save_as}; pub use info::{SAVE_TYPES, format_bytes}; use print::{export, print}; pub use print::{print_page_size, print_params, print_slides}; @@ -47,11 +47,11 @@ pub enum Page { SaveAs, Print, Export, - Account, + About, } impl Page { - pub const ALL: [Page; 8] = [Page::Home, Page::New, Page::Open, Page::Info, Page::SaveAs, Page::Print, Page::Export, Page::Account]; + pub const ALL: [Page; 8] = [Page::Home, Page::New, Page::Open, Page::Info, Page::SaveAs, Page::Print, Page::Export, Page::About]; /// The id `app.backstage {page}` takes. pub fn id(self) -> &'static str { @@ -63,12 +63,16 @@ impl Page { Page::SaveAs => "saveAs", Page::Print => "print", Page::Export => "export", - Page::Account => "account", + Page::About => "about", } } pub fn parse(id: &str) -> Option { let id = id.trim(); + // Keep existing control-channel callers working after the visible page rename. + if id.eq_ignore_ascii_case("account") { + return Some(Page::About); + } Page::ALL.into_iter().find(|p| p.id().eq_ignore_ascii_case(id)) } @@ -82,7 +86,7 @@ impl Page { Page::SaveAs => "Save As", Page::Print => "Print", Page::Export => "Export", - Page::Account => "Account", + Page::About => "About", } } @@ -95,7 +99,7 @@ impl Page { Page::SaveAs => Icon::SaveAs, Page::Print => Icon::Print, Page::Export => Icon::Export, - Page::Account => Icon::Account, + Page::About => Icon::Help, } } @@ -140,7 +144,7 @@ pub fn entries(has_doc: bool) -> (Vec