Scripts: variables follow the topmost-first page item order and the gate's linked-file argument

This commit is contained in:
dotCooCoo committed 2026-11-26 00:44:53 -08:00
1 parent 2909471ebc
commit 27c3f8cb29
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -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())
}
+2 -2
View File
@@ -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)
}