From 27c3f8cb290d115da93d6a20b59f5baa66ff93ae Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 26 Nov 2026 00:44:53 -0800 Subject: [PATCH] Scripts: variables follow the topmost-first page item order and the gate's linked-file argument --- crates/engine/src/script/dom/variables.rs | 2 +- crates/engine/src/tests/script_variables.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/script/dom/variables.rs b/crates/engine/src/script/dom/variables.rs index d36c9f1f45..6c405f6051 100644 --- a/crates/engine/src/script/dom/variables.rs +++ b/crates/engine/src/script/dom/variables.rs @@ -352,7 +352,7 @@ fn file_arg(h: &Host, a: &[Data], what: &str, access: Access) -> std::result::Re if path.chars().count() > super::super::files::MAX_PATH_CHARS { return Err(HostError::Range(format!("{what}: the path is too long"))); } - let gate = h.disk.borrow().gate(Vec::new()); + let gate = h.disk.borrow().gate(Vec::new(), crate::file_access::LinkedFiles::default()); gate.check(path, access).map_err(HostError::Error)?; Ok(path.to_string()) } diff --git a/crates/engine/src/tests/script_variables.rs b/crates/engine/src/tests/script_variables.rs index 5ff2301bbf..8f032a2bb8 100644 --- a/crates/engine/src/tests/script_variables.rs +++ b/crates/engine/src/tests/script_variables.rs @@ -27,12 +27,12 @@ fn undo_steps(s: &Session) -> usize { s.active().unwrap().history.undo.len() } -/// A document with a type object and a rectangle. +/// A document with a rectangle and, above it, a type object, so `pageItems[0]` is the type and `pageItems[1]` the rectangle. fn doc() -> (Session, NodeId, NodeId) { let mut s = Session::new(); s.execute("file.new", &json!({"width": 400, "height": 300})).unwrap(); - let t = NodeId(s.execute("text.create", &json!({"x": 10, "y": 20, "text": "Hello"})).unwrap()["id"].as_u64().unwrap()); let r = NodeId(s.execute("shape.rectangle", &json!({"x": 100, "y": 100, "width": 50, "height": 50})).unwrap()["id"].as_u64().unwrap()); + let t = NodeId(s.execute("text.create", &json!({"x": 10, "y": 20, "text": "Hello"})).unwrap()["id"].as_u64().unwrap()); (s, t, r) }