Merge pull request #9139 from dotCooCoo/feat/plugin-api-events

Plug-ins: react to selection, layer, open and save events
This commit is contained in:
.CooCoo authored and GitHub committed 2026-12-02 11:15:23 -08:00
commit dcb7085b2a
34 files changed
+2880 -29

No files matched your search

+9
View File
@@ -664,6 +664,8 @@ pub(crate) struct Savepoint {
pending_paint: Option<crate::Paint>,
choices: Choices,
journal: usize,
/// The plug-in events queued before the command ([`Session::plugin_events_mark`]).
plugin_events: u64,
}
impl Savepoint {
@@ -698,6 +700,7 @@ impl Savepoint {
pending_paint: s.pending_paint.clone(),
choices: Choices::of(s),
journal: s.journal.len(),
plugin_events: s.plugin_events_mark(),
}
}
@@ -750,6 +753,8 @@ impl Savepoint {
s.pending_paint = self.pending_paint;
self.choices.put(s);
s.journal.truncate(self.journal);
// The documents the command opened are closed again: plug-ins are not told of them.
s.forget_plugin_opens_since(self.plugin_events);
s.sync_front_profiles();
exact
}
@@ -2202,6 +2207,8 @@ impl Session {
lost
});
drop(lost);
// The job's working copy went with it, with the documents the run opened.
self.plugin_events_script_ended(false);
raise_ids(self);
self.script_stop.clear();
self.reset_tool();
@@ -2597,6 +2604,7 @@ impl Session {
let mut report = failure_report(&job.name, &e, file.as_deref(), &job.host, fuel_left, job.realm.limits().fuel.saturating_sub(fuel_left));
close_run(self, &job.host, &mut report, ending(&e.kind));
self.end_job(job, e.kind == RunErrorKind::Internal);
self.plugin_events_script_ended(false);
raise_ids(self);
self.script_stop.clear();
self.reset_tool();
@@ -2701,6 +2709,7 @@ impl Session {
close_run(self, host, &mut report, console::Ending::Finished);
let tool = host.dom.chosen_tool();
self.end_job(job, false);
self.plugin_events_script_ended(true);
// The tool `app.selectTool` chose last becomes the current tool, as a choice on the
// toolbar makes it; the run's changes are kept when the tool cannot be chosen.
if let Some(id) = tool