Resolve and test style changes through Arc::make_mut after the shared-stylesheet change on main

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
vangel76andClaude Sonnet 5.5 committed 2026-11-05 03:32:58 +01:00
1 parent 7814450d0a
commit 097cddbd03
4 files changed
+9 -7

No files matched your search

+1 -1
View File
@@ -309,7 +309,7 @@ fn styles_and_lists_round_trip() {
fn tracked_style_definition_change_round_trips() {
let mut d = Document::new();
d.revisions.push(Revision { kind: RevisionKind::Format, author: "Ana".into(), date: "2026-10-17T10:00:00Z".into(), move_name: None });
d.styles.upsert(Style {
std::sync::Arc::make_mut(&mut d.styles).upsert(Style {
id: "Mine".into(),
name: "Mine".into(),
kind: StyleKind::Paragraph,
+1 -1
View File
@@ -242,7 +242,7 @@ pub(crate) fn record(s: &mut Session, id: &str, before: &Document) {
r.blocks(&pb.blocks, &mut pa.blocks, 0);
}
}
r.styles(&before.styles.styles, &mut doc.styles.styles);
r.styles(&before.styles.styles, &mut std::sync::Arc::make_mut(&mut doc.styles).styles);
}
/// Record the paragraph formatting a command changed on the paragraph at `path` whose text it also
+5 -3
View File
@@ -101,7 +101,7 @@ fn resolve_styles_sel(s: &mut Session, selected: bool, accept: bool) -> Result<b
if !s.doc.styles.styles.iter().any(|st| st.para_change.is_some() || st.chr_change.is_some()) {
return Ok(false);
}
for st in &mut s.doc.styles.styles {
for st in &mut std::sync::Arc::make_mut(&mut s.doc.styles).styles {
fmt_revisions::resolve_style(st, accept);
}
Ok(true)
@@ -209,8 +209,10 @@ fn resolve_all(s: &mut Session, accept: bool) -> CmdResult {
fmt_revisions::resolve_containers(&mut part.blocks, accept, 0);
}
fmt_revisions::resolve_section(&mut s.doc.last_section, accept);
for st in &mut s.doc.styles.styles {
fmt_revisions::resolve_style(st, accept);
if s.doc.styles.styles.iter().any(|st| st.para_change.is_some() || st.chr_change.is_some()) {
for st in &mut std::sync::Arc::make_mut(&mut s.doc.styles).styles {
fmt_revisions::resolve_style(st, accept);
}
}
// The note separators are block lists of their own, not stories; they must not keep ids of
// revisions that are about to be dropped.
+2 -2
View File
@@ -3319,7 +3319,7 @@ fn non_property_style_changes_are_not_recorded_as_formatting() {
let mut s = s();
run(&mut s, "review.trackChanges", json!({"value": true}));
let before = s.doc.clone();
let st = s.doc.styles.get_mut("Heading1").unwrap();
let st = std::sync::Arc::make_mut(&mut s.doc.styles).get_mut("Heading1").unwrap();
st.based_on = Some("Title".into());
st.next = Some("Heading2".into());
st.linked = Some("Emphasis".into());
@@ -3363,7 +3363,7 @@ fn tracked_style_change_round_trips_through_docx() {
fn rejecting_a_reopened_style_change_keeps_style_metadata() {
use wordcraft_doc::styles::{Style, StyleKind, TableStyleParts};
let mut s = s();
s.doc.styles.upsert(Style {
std::sync::Arc::make_mut(&mut s.doc.styles).upsert(Style {
id: "GridX".into(),
name: "Grid X".into(),
kind: StyleKind::Table,