forked from 1b-agent/opencadstudio-upstream
fix(script): support AutoCAD .scr scripts with multi-line, single-line, and prefix handling
This commit is contained in:
1 parent
ab0682153d
commit
f32d0422d2
6 files changed
+222
-34
No files matched your search
@@ -1976,7 +1976,13 @@ impl OpenCADStudio {
|
||||
}
|
||||
self.drain_pending_open()
|
||||
};
|
||||
Task::batch([thumbs_task, pending_open_task, interaction_task])
|
||||
let startup_script_task = if !self.pending_startup_script_lines.is_empty() {
|
||||
let lines = std::mem::take(&mut self.pending_startup_script_lines);
|
||||
Task::batch(lines.into_iter().map(|l| Task::done(Message::ScriptLine(l))))
|
||||
} else {
|
||||
Task::none()
|
||||
};
|
||||
Task::batch([thumbs_task, pending_open_task, interaction_task, startup_script_task])
|
||||
}
|
||||
|
||||
pub(super) fn on_wblock_save_result_some(
|
||||
|
||||
@@ -982,6 +982,9 @@ impl OpenCADStudio {
|
||||
.extension()
|
||||
.map(|e| e.to_string_lossy().to_lowercase())
|
||||
.unwrap_or_default();
|
||||
if ext == "scr" {
|
||||
return self.dispatch_command(&format!("SCRIPT \"{}\"", path.display()));
|
||||
}
|
||||
if !matches!(ext.as_str(), "dwg" | "dxf" | "bak" | "sv$") {
|
||||
self.command_line.push_error(
|
||||
crate::tf!("Unsupported file type: {}", path.display()).as_ref(),
|
||||
@@ -2506,13 +2509,7 @@ impl OpenCADStudio {
|
||||
self.dispatch_command(&cmd)
|
||||
}
|
||||
|
||||
Message::ScriptLine(line) => {
|
||||
if line.trim().is_empty() {
|
||||
self.feed_command(crate::command::StepInput::Enter)
|
||||
} else {
|
||||
self.run_command_line(&line)
|
||||
}
|
||||
}
|
||||
Message::ScriptLine(line) => self.feed_script_line(&line),
|
||||
|
||||
Message::ToggleLayers => {
|
||||
if self.active_modal == Some(super::ModalKind::Layers) {
|
||||
|
||||
Reference in new issue
Block a user