merge: TEXTEDIT command + TEXTEDITMODE sysvar (#130)
Merge PR #130 (KarimJerbi) and resolve review findings: - Conflict (settings.rs): keep current persisted-settings layout, append texteditmode field. - Conflict (command/mod.rs): keep both new CmdResult variants — main's live-entity ops and the PR's text-edit suspend/resume. - Bug: invalid TEXTEDITMODE value no longer aborts via the Measurement arm; it now re-prompts with the error and stays active. - Dedup: single parse_texteditmode() helper replaces the value parsing duplicated across commands.rs, settings.rs and textedit.rs. - Strip trailing whitespace. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
commit
8c48233dcf
11 changed files with 399 additions and 14 deletions
|
|
@ -1699,6 +1699,41 @@ impl OpenCADStudio {
|
|||
self.ribbon.deactivate_tool();
|
||||
return self.begin_text_edit(handle);
|
||||
}
|
||||
CmdResult::SuspendForTextEdit { handle } => {
|
||||
let is_editable = crate::app::text_inline::can_edit_text(handle, &self.tabs[i].scene.document);
|
||||
if !is_editable {
|
||||
self.command_line.push_error("TEXTEDIT: selected entity is not text.");
|
||||
let prompt = self.tabs[i].active_cmd.as_ref().map(|c| c.prompt());
|
||||
if let Some(p) = prompt {
|
||||
self.command_line.push_info(&p);
|
||||
}
|
||||
return Task::none();
|
||||
}
|
||||
let cmd = self.tabs[i].active_cmd.take();
|
||||
self.tabs[i].suspended_cmd = cmd;
|
||||
self.tabs[i].snap_result = None;
|
||||
self.tabs[i].scene.clear_preview_wire();
|
||||
self.restore_pre_cmd_tangent();
|
||||
self.ribbon.deactivate_tool();
|
||||
return self.begin_text_edit(handle);
|
||||
}
|
||||
CmdResult::UndoDocument => {
|
||||
let active = self.tabs[i].active_cmd.take();
|
||||
self.undo_active_tab();
|
||||
self.tabs[i].active_cmd = active;
|
||||
let prompt = self.tabs[i].active_cmd.as_ref().map(|c| c.prompt());
|
||||
if let Some(p) = prompt {
|
||||
self.command_line.push_info(&p);
|
||||
}
|
||||
}
|
||||
CmdResult::SetTexteditMode(val) => {
|
||||
self.texteditmode = val;
|
||||
let display_val = if val { 1 } else { 0 };
|
||||
self.command_line.push_output(&format!("TEXTEDITMODE set to {display_val}"));
|
||||
self.tabs[i].active_cmd = None;
|
||||
self.tabs[i].snap_result = None;
|
||||
self.tabs[i].scene.clear_preview_wire();
|
||||
}
|
||||
CmdResult::DdeditEntity { handle, new_text } => {
|
||||
let mut updated = false;
|
||||
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue