Insert and paste count group members when picking the next automatic name

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-30 15:53:18 -04:00
co-authored by Claude Opus 5.5
parent 34af55bd6b
commit 352fec7725
4 changed files with 47 additions and 7 deletions
+6 -3
View File
@@ -321,7 +321,7 @@ fn paste(s: &mut Session, p: &Value) -> Result<Value> {
let mut shapes = clip.shapes.clone();
reid("edit.paste", doc, &mut shapes)?;
crate::media_refs::visit_mut::shapes(&mut shapes, &mut remap_media(&media));
let mut taken = super::current_names(doc, sel);
let (mut taken, mut count) = super::current_names(doc, sel);
for sh in &mut shapes {
// Only a name already on the slide is changed (two shapes with one name are what the
// issue is about); otherwise it stays, as Morph pairs shapes across slides by name.
@@ -330,9 +330,12 @@ fn paste(s: &mut Session, p: &Value) -> Result<Value> {
&& !n.is_empty()
&& n.bytes().all(|b| b.is_ascii_digit())
{
sh.name = super::insert::first_free_name(base, &taken, taken.len());
sh.name = super::insert::first_free_name(base, &taken, count);
}
taken.insert(sh.name.clone());
deckcraft_model::walk(std::slice::from_ref(sh), &mut |m, _| {
taken.insert(m.name.clone());
count += 1;
});
if let Some(x) = sh.xfrm.as_mut() {
x.x += off;
x.y += off;
+2 -2
View File
@@ -198,8 +198,8 @@ pub(crate) fn add_shape(s: &mut Session, cmd: &str, mut shape: Shape, select: bo
shape.id = ShapeId(doc.alloc_id().ok_or_else(|| bad(cmd, NO_ID_SPACE))?);
if shape.name.is_empty() {
let base = auto_name_base(&shape);
let taken = super::current_names(doc, sel);
shape.name = first_free_name(&base, &taken, taken.len());
let (taken, count) = super::current_names(doc, sel);
shape.name = first_free_name(&base, &taken, count);
}
let id = shape.id;
let list = crate::shapes_mut(doc, sel).ok_or_else(|| bad("insert", "no slide"))?;