From 502fb2ba73a3809b36d720982eaea5b5935242f4 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Tue, 20 Oct 2026 18:03:20 +0000 Subject: [PATCH] Indent table rows in outline export so they stay on their slide Found while testing crates/format/src/lib.rs:660-665 (slides_to_outline) and :573-574 (outline_to_slides) Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/format/src/lib.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/crates/format/src/lib.rs b/crates/format/src/lib.rs index 093cbaa6..c4fdaf8c 100644 --- a/crates/format/src/lib.rs +++ b/crates/format/src/lib.rs @@ -660,6 +660,7 @@ pub fn slides_to_outline(p: &Presentation) -> String { if let ShapeKind::Table(t) = &sh.kind { for row in &t.rows { let cells: Vec = row.cells.iter().map(|c| c.text.text().replace(['\u{b}', '\n'], " ")).collect(); + out.push('\t'); out.push_str(&cells.join("\t")); out.push('\n'); } @@ -1087,3 +1088,27 @@ fn outline_includes_table_text() { assert!(out.contains("Cell A1\tCell B1"), "{out}"); assert!(out.contains("Cell A2\tCell B2"), "{out}"); } + +#[test] +fn outline_table_rows_are_indented_and_do_not_become_slides() { + use deckcraft_model::table::{Cell, Row, Table}; + use deckcraft_model::{Shape, ShapeKind, Xfrm}; + let mut p = defaults::new_presentation(None); + let layout = defaults::layout_of_kind(&p, LayoutType::TitleAndContent).unwrap(); + let mut s = defaults::new_slide(&mut p, layout).expect("slide"); + s.shapes.retain(|sh| !sh.ph_type().is_some_and(|k| k.is_title())); + let mut table = Table { cols: vec![200.0, 200.0], ..Default::default() }; + for texts in [["A1", "B1"], ["A2", "B2"]] { + let cells: Vec = texts.iter().map(|t| Cell { text: TextBody::from_text(t), ..Default::default() }).collect(); + table.rows.push(Row { height: 30.0, cells }); + } + let mut tbl = Shape { xfrm: Some(Xfrm::new(0.0, 100.0, 400.0, 60.0)), ..Default::default() }; + tbl.kind = ShapeKind::Table(table); + s.shapes.push(tbl); + p.slides = vec![std::sync::Arc::new(s)]; + + let out = slides_to_outline(&p); + let mut q = defaults::new_presentation(None); + q.slides.clear(); + assert_eq!(outline_to_slides(&mut q, &out), 0, "table rows became slides: {out:?}"); +}