forked from 1b-agent/opencadstudio-upstream
feat(table): add TABLEDIT point picking, and consolidate InputKind
- Implement `TABLEDIT` command supporting viewport point-picking on cell interiors - Support overlapping table hit testing with selection cycling and top-table resolution - Support `/n` and `\n` multiline paragraph breaks (`\P`) in table cell text editing - Unify text input modes via `InputKind` (`Point`, `SingleToken`, `FreeText`) on `CadCommand` - Migrate 15+ commands across annotate, draw, insert, layout, and view modules - Preserve text casing, literal spaces, and bypass arithmetic eval during FreeText input - Add dedicated `tabledit_tests` and `free_text_entry_tests` test suites
This commit is contained in:
1 parent
bde9cc2715
commit
d6a6dd6a7d
23 files changed
+860
-254
No files matched your search
@@ -666,6 +666,13 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"TABLEDIT" => {
|
||||
use crate::modules::annotate::table_cmd::TableditCommand;
|
||||
let cmd = TableditCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"DIMCONTINUE" => {
|
||||
use crate::modules::annotate::dim_continue::DimContinueCommand;
|
||||
let scene = &self.tabs[i].scene;
|
||||
|
||||
@@ -1285,8 +1285,12 @@ impl CadCommand for DrawOrderCommand {
|
||||
}
|
||||
}
|
||||
|
||||
fn wants_text_input(&self) -> bool {
|
||||
!matches!(self.step, DrawOrderStep::SelectObjects)
|
||||
fn input_kind(&self) -> crate::command::InputKind {
|
||||
if matches!(self.step, DrawOrderStep::SelectObjects) {
|
||||
crate::command::InputKind::Point
|
||||
} else {
|
||||
crate::command::InputKind::SingleToken
|
||||
}
|
||||
}
|
||||
|
||||
fn is_selection_gathering(&self) -> bool {
|
||||
@@ -2116,7 +2120,7 @@ mod tests {
|
||||
|
||||
// 1. Shortcut 'F' -> Front
|
||||
let mut cmd = DrawOrderCommand::new(vec![h_hatch]);
|
||||
assert_eq!(cmd.wants_text_input(), true);
|
||||
assert_eq!(cmd.input_kind().wants_text(), true);
|
||||
let res = cmd.on_text_input("F");
|
||||
match res {
|
||||
Some(crate::command::CmdResult::Relaunch(c, handles)) => {
|
||||
@@ -2242,14 +2246,14 @@ mod tests {
|
||||
// Start command with no pre-selection
|
||||
let mut cmd = DrawOrderCommand::new(vec![]);
|
||||
assert!(cmd.is_selection_gathering());
|
||||
assert!(!cmd.wants_text_input());
|
||||
assert!(!cmd.input_kind().wants_text());
|
||||
|
||||
// Gather selection
|
||||
let _ = cmd.on_selection_complete(vec![h_hatch]);
|
||||
let enter_res = cmd.on_enter();
|
||||
assert!(matches!(enter_res, crate::command::CmdResult::NeedPoint));
|
||||
assert!(!cmd.is_selection_gathering());
|
||||
assert!(cmd.wants_text_input());
|
||||
assert!(cmd.input_kind().wants_text());
|
||||
|
||||
// Choose verb Front
|
||||
let res = cmd.on_text_input("F");
|
||||
|
||||
Reference in new issue
Block a user