Merge remote-tracking branch 'origin/main' into codex/field-command

# Conflicts:
#	src/ui/window/attdef_dialog.rs
This commit is contained in:
ramox81 committed 2026-10-02 10:46:53 +03:00
commit 762cf1e7e4
68 files changed
+4665 -1048

No files matched your search

+21 -2
View File
@@ -771,6 +771,7 @@ impl OpenCADStudio {
self.command_line
.push_output(crate::tf!("Block \"{name}\" created.").as_ref());
self.refresh_properties();
self.note_recent_block(&name);
self.refresh_block_palette();
}
Err(err) => {
@@ -1008,7 +1009,16 @@ impl OpenCADStudio {
self.commit_entity(entity);
self.tabs[i].dirty = true;
self.tabs[i].scene.clear_preview_wire();
self.tabs[i].active_cmd = None;
// A repeating insertion keeps its command for the next block.
let keep = self.tabs[i].active_cmd.as_ref().is_some_and(|c| c.attreq_continue());
if keep {
let prompt = self.tabs[i].active_cmd.as_ref().map(|c| c.prompt());
if let Some(p) = prompt {
self.command_line.push_info(&p);
}
} else {
self.tabs[i].active_cmd = None;
}
self.tabs[i].snap_result = None;
if let Some(n) = insert_name {
self.record_block_insert(&n);
@@ -1024,7 +1034,16 @@ impl OpenCADStudio {
.as_mut()
.and_then(|cmd| cmd.attreq_set_attdefs(attdefs));
if let Some(entity) = completed {
return Some(self.apply_cmd_result(CmdResult::CommitAndExit(entity)));
if let codec::EntityType::Insert(ins) = &entity {
let name = ins.block_name.clone();
self.record_block_insert(&name);
}
let keep = self.tabs[i].active_cmd.as_ref().is_some_and(|c| c.attreq_continue());
return Some(self.apply_cmd_result(if keep {
CmdResult::CommitEntity(entity)
} else {
CmdResult::CommitAndExit(entity)
}));
}
let prompt = self.tabs[i].active_cmd.as_ref().map(|c| c.prompt());
if let Some(p) = prompt {
+26
View File
@@ -767,6 +767,32 @@ impl OpenCADStudio {
return task;
}
}
CmdResult::CommitExplodedInsert { insert, keep_going } => {
let i = self.active_tab;
if let codec::EntityType::Insert(ins) = &insert {
let name = ins.block_name.clone();
self.record_block_insert(&name);
}
let pieces = crate::modules::draw::modify::explode::explode_entity(
&insert,
&self.tabs[i].scene.document,
);
if keep_going {
if let Some(task) = self.handle_commit_entities(
pieces,
preserve_commit_style,
preserve_commit_layer,
) {
return task;
}
} else {
self.handle_commit_entities_and_exit(
pieces,
preserve_commit_style,
preserve_commit_layer,
);
}
}
CmdResult::AttreqNeeded { block_name } => {
if let Some(task) = self.handle_attreq_needed(block_name) {
return task;
+57
View File
@@ -1139,4 +1139,61 @@ impl OpenCADStudio {
return task;
}
}
/// Feed one line from a command script (.scr) into the command pipeline.
///
/// If an interactive command is active, the line (or its tokens) is routed to
/// the active command's prompts (e.g. coordinates or options). If no command
/// is active, the line starts a new command (supporting both bare verbs and
/// inline single-line commands).
pub(in crate::app) fn feed_script_line(&mut self, line: &str) -> Task<Message> {
let i = self.active_tab;
let trimmed = line.trim();
// 1. Text editor currently open (e.g. TEXT command content step).
if self.text_inline.is_some() {
if let Some(editor) = self.text_inline.as_mut() {
editor.value = line.to_string();
}
let committed = self.text_inline_commit();
let task = self.post_editor_closed(committed);
return if committed {
Task::batch([task, Task::done(Message::CommandEscape)])
} else {
task
};
}
// 2. Blank line submits Enter to the active command (or repeats last).
if trimmed.is_empty() {
return self.feed_command(StepInput::Enter);
}
// 3. A command is currently active: route to its prompt handlers.
if self.tabs[i].active_cmd.is_some() {
if self.tabs[i]
.active_cmd
.as_ref()
.map(|c| c.input_kind().is_free_text())
.unwrap_or(false)
{
return self.feed_command(StepInput::Text(trimmed.to_string()));
}
let tokens: Vec<&str> = trimmed.split_whitespace().collect();
let mut tasks = Vec::new();
for tok in tokens {
if self.tabs[i].active_cmd.is_none() {
// Preceding token finished the active command; remaining tokens start a new one.
tasks.push(self.run_command_line(tok));
} else {
tasks.push(self.feed_active_cmd(tok));
}
}
return Task::batch(tasks);
}
// 4. No command is active: run as top-level command.
self.run_command_line(trimmed)
}
}