Scripts: app.redraw returns without changing the documents

A script that called app.redraw() stopped with an error, because app had
no such member. The call now returns undefined and adds no undo step. A
run works on its own copy of the documents, and the app draws the
documents as they were before the run until the run ends, so the call
has nothing new to draw.
This commit is contained in:
dotCooCoo committed 2026-11-24 23:58:24 -08:00
1 parent dc9adb195d
commit e45b922802
5 files changed
+32 -3

No files matched your search

+8
View File
@@ -714,6 +714,13 @@ fn path_key(p: &str) -> String {
if windows { p.to_lowercase() } else { p }
}
/// `app.redraw()`: returns without changing anything. The app draws a frame between the run's
/// slices on its own, and it draws the documents as they were before the run until the run ends,
/// so there is nothing for the call to draw. It adds no undo step.
fn app_redraw(_: &Host, _: &[Data]) -> Answer {
Ok(Data::Undefined)
}
/// `app.getIsFileOpen(path)`: whether a document open in the run has the file `path`. The path is
/// compared as text with the documents' files and is not resolved; a document whose file the
/// automation read roots do not allow does not count, and that check can look the file up on disk.
@@ -1948,6 +1955,7 @@ pub(super) fn install(realm: &mut Realm, link: &Link) -> std::result::Result<(),
("selection", get(l, app_selection)),
("coordinateSystem", property(l, app_coords, app_set_coords)),
("getIsFileOpen", method(l, app_is_open)),
("redraw", method(l, app_redraw)),
]);
application.push(later(l, "Application", "beep"));
let preset = {