From bcd52be4c7c98f68eb979b425ffa9889efbce789 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Thu, 15 Oct 2026 00:16:35 +0300 Subject: [PATCH] block definition: locale coverage, tests for the new defaults, wraps - block-def strings in every locale (English until translated); the catalog test requires each locale to carry them. - A new block's base point starts at 0, and ATTMAN / BATTMAN report a drawing without attributed blocks; the tests expect that now. - Lines over 100 columns wrapped. Co-Authored-By: Claude Opus 5.5 --- locales/ar-SA/opencadstudio.ftl | 6 ++++++ locales/bg-BG/opencadstudio.ftl | 6 ++++++ locales/cs-CZ/opencadstudio.ftl | 6 ++++++ locales/de-DE/opencadstudio.ftl | 6 ++++++ locales/el-GR/opencadstudio.ftl | 6 ++++++ locales/es-ES/opencadstudio.ftl | 6 ++++++ locales/fi-FI/opencadstudio.ftl | 6 ++++++ locales/fr-FR/opencadstudio.ftl | 6 ++++++ locales/hi-IN/opencadstudio.ftl | 6 ++++++ locales/hu-HU/opencadstudio.ftl | 6 ++++++ locales/it-IT/opencadstudio.ftl | 6 ++++++ locales/ja-JP/opencadstudio.ftl | 6 ++++++ locales/ko-KR/opencadstudio.ftl | 6 ++++++ locales/lo-LA/opencadstudio.ftl | 6 ++++++ locales/nl-NL/opencadstudio.ftl | 6 ++++++ locales/pl-PL/opencadstudio.ftl | 6 ++++++ locales/pt-BR/opencadstudio.ftl | 6 ++++++ locales/ru-RU/opencadstudio.ftl | 6 ++++++ locales/zh-CN/opencadstudio.ftl | 6 ++++++ locales/zh-TW/opencadstudio.ftl | 6 ++++++ src/app/command_driver/tests.rs | 4 ++-- src/app/commands/block_cmdline.rs | 4 ++-- src/app/commands/blocks.rs | 31 +++++++++-------------------- src/app/update/file.rs | 10 ++++++++-- src/app/update/mod.rs | 4 +++- src/modules/insert/block_cmdline.rs | 3 ++- src/scene/block_base_point_tests.rs | 10 +++++----- src/sys.rs | 3 ++- 28 files changed, 153 insertions(+), 36 deletions(-) diff --git a/locales/ar-SA/opencadstudio.ftl b/locales/ar-SA/opencadstudio.ftl index 5f29ea978..115c1cc05 100644 --- a/locales/ar-SA/opencadstudio.ftl +++ b/locales/ar-SA/opencadstudio.ftl @@ -6560,3 +6560,9 @@ keytips = selection-report = .found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total .found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total + +block-def = + .name-too-short = The name must be at least one character long. + .name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = ` + .definition-changed-redefine = The block definition has changed. Do you want to redefine it ? + .create-drawing-file = Create Drawing File diff --git a/locales/bg-BG/opencadstudio.ftl b/locales/bg-BG/opencadstudio.ftl index 563fe9966..66e1efb00 100644 --- a/locales/bg-BG/opencadstudio.ftl +++ b/locales/bg-BG/opencadstudio.ftl @@ -6548,3 +6548,9 @@ keytips = selection-report = .found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total .found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total + +block-def = + .name-too-short = The name must be at least one character long. + .name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = ` + .definition-changed-redefine = The block definition has changed. Do you want to redefine it ? + .create-drawing-file = Create Drawing File diff --git a/locales/cs-CZ/opencadstudio.ftl b/locales/cs-CZ/opencadstudio.ftl index eb9b20081..1e7ad359d 100644 --- a/locales/cs-CZ/opencadstudio.ftl +++ b/locales/cs-CZ/opencadstudio.ftl @@ -6545,3 +6545,9 @@ keytips = selection-report = .found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total .found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total + +block-def = + .name-too-short = The name must be at least one character long. + .name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = ` + .definition-changed-redefine = The block definition has changed. Do you want to redefine it ? + .create-drawing-file = Create Drawing File diff --git a/locales/de-DE/opencadstudio.ftl b/locales/de-DE/opencadstudio.ftl index 67f30b623..4f2dc5862 100644 --- a/locales/de-DE/opencadstudio.ftl +++ b/locales/de-DE/opencadstudio.ftl @@ -6546,3 +6546,9 @@ keytips = selection-report = .found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total .found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total + +block-def = + .name-too-short = The name must be at least one character long. + .name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = ` + .definition-changed-redefine = The block definition has changed. Do you want to redefine it ? + .create-drawing-file = Create Drawing File diff --git a/locales/el-GR/opencadstudio.ftl b/locales/el-GR/opencadstudio.ftl index 6f7e3d334..1335f5567 100644 --- a/locales/el-GR/opencadstudio.ftl +++ b/locales/el-GR/opencadstudio.ftl @@ -6548,3 +6548,9 @@ keytips = selection-report = .found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total .found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total + +block-def = + .name-too-short = The name must be at least one character long. + .name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = ` + .definition-changed-redefine = The block definition has changed. Do you want to redefine it ? + .create-drawing-file = Create Drawing File diff --git a/locales/es-ES/opencadstudio.ftl b/locales/es-ES/opencadstudio.ftl index 00a112676..a14a8d851 100644 --- a/locales/es-ES/opencadstudio.ftl +++ b/locales/es-ES/opencadstudio.ftl @@ -6548,3 +6548,9 @@ keytips = selection-report = .found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total .found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total + +block-def = + .name-too-short = The name must be at least one character long. + .name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = ` + .definition-changed-redefine = The block definition has changed. Do you want to redefine it ? + .create-drawing-file = Create Drawing File diff --git a/locales/fi-FI/opencadstudio.ftl b/locales/fi-FI/opencadstudio.ftl index ba459e123..6682909aa 100644 --- a/locales/fi-FI/opencadstudio.ftl +++ b/locales/fi-FI/opencadstudio.ftl @@ -6545,3 +6545,9 @@ keytips = selection-report = .found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total .found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total + +block-def = + .name-too-short = The name must be at least one character long. + .name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = ` + .definition-changed-redefine = The block definition has changed. Do you want to redefine it ? + .create-drawing-file = Create Drawing File diff --git a/locales/fr-FR/opencadstudio.ftl b/locales/fr-FR/opencadstudio.ftl index c8b7961e9..4403c1d40 100644 --- a/locales/fr-FR/opencadstudio.ftl +++ b/locales/fr-FR/opencadstudio.ftl @@ -6548,3 +6548,9 @@ keytips = selection-report = .found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total .found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total + +block-def = + .name-too-short = The name must be at least one character long. + .name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = ` + .definition-changed-redefine = The block definition has changed. Do you want to redefine it ? + .create-drawing-file = Create Drawing File diff --git a/locales/hi-IN/opencadstudio.ftl b/locales/hi-IN/opencadstudio.ftl index d29e7813f..4f69be5f5 100644 --- a/locales/hi-IN/opencadstudio.ftl +++ b/locales/hi-IN/opencadstudio.ftl @@ -6536,3 +6536,9 @@ keytips = selection-report = .found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total .found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total + +block-def = + .name-too-short = The name must be at least one character long. + .name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = ` + .definition-changed-redefine = The block definition has changed. Do you want to redefine it ? + .create-drawing-file = Create Drawing File diff --git a/locales/hu-HU/opencadstudio.ftl b/locales/hu-HU/opencadstudio.ftl index 8bacbf692..d227954e4 100644 --- a/locales/hu-HU/opencadstudio.ftl +++ b/locales/hu-HU/opencadstudio.ftl @@ -6532,3 +6532,9 @@ keytips = selection-report = .found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total .found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total + +block-def = + .name-too-short = The name must be at least one character long. + .name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = ` + .definition-changed-redefine = The block definition has changed. Do you want to redefine it ? + .create-drawing-file = Create Drawing File diff --git a/locales/it-IT/opencadstudio.ftl b/locales/it-IT/opencadstudio.ftl index 3fc69a2ba..8ee782f36 100644 --- a/locales/it-IT/opencadstudio.ftl +++ b/locales/it-IT/opencadstudio.ftl @@ -6547,3 +6547,9 @@ keytips = selection-report = .found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total .found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total + +block-def = + .name-too-short = The name must be at least one character long. + .name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = ` + .definition-changed-redefine = The block definition has changed. Do you want to redefine it ? + .create-drawing-file = Create Drawing File diff --git a/locales/ja-JP/opencadstudio.ftl b/locales/ja-JP/opencadstudio.ftl index 2299469e5..0e49b74f3 100644 --- a/locales/ja-JP/opencadstudio.ftl +++ b/locales/ja-JP/opencadstudio.ftl @@ -6536,3 +6536,9 @@ keytips = selection-report = .found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total .found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total + +block-def = + .name-too-short = The name must be at least one character long. + .name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = ` + .definition-changed-redefine = The block definition has changed. Do you want to redefine it ? + .create-drawing-file = Create Drawing File diff --git a/locales/ko-KR/opencadstudio.ftl b/locales/ko-KR/opencadstudio.ftl index 3dd4eef16..a93158a0d 100644 --- a/locales/ko-KR/opencadstudio.ftl +++ b/locales/ko-KR/opencadstudio.ftl @@ -6547,3 +6547,9 @@ keytips = selection-report = .found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total .found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total + +block-def = + .name-too-short = The name must be at least one character long. + .name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = ` + .definition-changed-redefine = The block definition has changed. Do you want to redefine it ? + .create-drawing-file = Create Drawing File diff --git a/locales/lo-LA/opencadstudio.ftl b/locales/lo-LA/opencadstudio.ftl index 6455bac0c..de6e265a7 100644 --- a/locales/lo-LA/opencadstudio.ftl +++ b/locales/lo-LA/opencadstudio.ftl @@ -6548,3 +6548,9 @@ keytips = selection-report = .found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total .found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total + +block-def = + .name-too-short = The name must be at least one character long. + .name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = ` + .definition-changed-redefine = The block definition has changed. Do you want to redefine it ? + .create-drawing-file = Create Drawing File diff --git a/locales/nl-NL/opencadstudio.ftl b/locales/nl-NL/opencadstudio.ftl index 26b4a726e..89b69afd7 100644 --- a/locales/nl-NL/opencadstudio.ftl +++ b/locales/nl-NL/opencadstudio.ftl @@ -6546,3 +6546,9 @@ keytips = selection-report = .found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total .found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total + +block-def = + .name-too-short = The name must be at least one character long. + .name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = ` + .definition-changed-redefine = The block definition has changed. Do you want to redefine it ? + .create-drawing-file = Create Drawing File diff --git a/locales/pl-PL/opencadstudio.ftl b/locales/pl-PL/opencadstudio.ftl index de03ae6e3..abb137bee 100644 --- a/locales/pl-PL/opencadstudio.ftl +++ b/locales/pl-PL/opencadstudio.ftl @@ -6547,3 +6547,9 @@ keytips = selection-report = .found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total .found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total + +block-def = + .name-too-short = The name must be at least one character long. + .name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = ` + .definition-changed-redefine = The block definition has changed. Do you want to redefine it ? + .create-drawing-file = Create Drawing File diff --git a/locales/pt-BR/opencadstudio.ftl b/locales/pt-BR/opencadstudio.ftl index 8c0bb542e..d0dd578fc 100644 --- a/locales/pt-BR/opencadstudio.ftl +++ b/locales/pt-BR/opencadstudio.ftl @@ -6548,3 +6548,9 @@ keytips = selection-report = .found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total .found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total + +block-def = + .name-too-short = The name must be at least one character long. + .name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = ` + .definition-changed-redefine = The block definition has changed. Do you want to redefine it ? + .create-drawing-file = Create Drawing File diff --git a/locales/ru-RU/opencadstudio.ftl b/locales/ru-RU/opencadstudio.ftl index a34f87619..df29f9c86 100644 --- a/locales/ru-RU/opencadstudio.ftl +++ b/locales/ru-RU/opencadstudio.ftl @@ -6549,3 +6549,9 @@ keytips = selection-report = .found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total .found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total + +block-def = + .name-too-short = The name must be at least one character long. + .name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = ` + .definition-changed-redefine = The block definition has changed. Do you want to redefine it ? + .create-drawing-file = Create Drawing File diff --git a/locales/zh-CN/opencadstudio.ftl b/locales/zh-CN/opencadstudio.ftl index 5ff64abbe..bef4459c8 100644 --- a/locales/zh-CN/opencadstudio.ftl +++ b/locales/zh-CN/opencadstudio.ftl @@ -6531,3 +6531,9 @@ keytips = selection-report = .found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total .found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total + +block-def = + .name-too-short = The name must be at least one character long. + .name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = ` + .definition-changed-redefine = The block definition has changed. Do you want to redefine it ? + .create-drawing-file = Create Drawing File diff --git a/locales/zh-TW/opencadstudio.ftl b/locales/zh-TW/opencadstudio.ftl index ad0149f72..2a4d42102 100644 --- a/locales/zh-TW/opencadstudio.ftl +++ b/locales/zh-TW/opencadstudio.ftl @@ -6543,3 +6543,9 @@ keytips = selection-report = .found-duplicate-total = __ocs_fmt_0__ found (__ocs_fmt_1__ duplicate), __ocs_fmt_2__ total .found-removed-total = __ocs_fmt_0__ found, __ocs_fmt_1__ removed, __ocs_fmt_2__ total + +block-def = + .name-too-short = The name must be at least one character long. + .name-unsupported-chars = The name contains unsupported characters. The following characters are not supported: \ < > / ? " : ; * | , = ` + .definition-changed-redefine = The block definition has changed. Do you want to redefine it ? + .create-drawing-file = Create Drawing File diff --git a/src/app/command_driver/tests.rs b/src/app/command_driver/tests.rs index 502b646ad..b2ec4cb83 100644 --- a/src/app/command_driver/tests.rs +++ b/src/app/command_driver/tests.rs @@ -1582,8 +1582,8 @@ mod block_base_point_tests { app.block_definition .as_ref() .map(|s| s.base_point_y.as_str()), - Some("0.0000"), - "a new block still starts at 0.0000" + Some("0"), + "a new block starts at 0" ); let _ = app.update(Message::BlockDefNameSelect("DEF_BASE".to_string())); diff --git a/src/app/commands/block_cmdline.rs b/src/app/commands/block_cmdline.rs index 2fda72cac..c6764c97f 100644 --- a/src/app/commands/block_cmdline.rs +++ b/src/app/commands/block_cmdline.rs @@ -204,8 +204,8 @@ impl OpenCADStudio { self.push_undo_snapshot(i, "ATTSYNC"); let mut changes = Vec::new(); for handle in inserts { - let Some(codec::EntityType::Insert(ins)) = self.tabs[i].scene.document.get_entity(handle) - else { + let document = &self.tabs[i].scene.document; + let Some(codec::EntityType::Insert(ins)) = document.get_entity(handle) else { continue; }; let transform = crate::scene::render_graph::insert_transform_with_base(ins, base); diff --git a/src/app/commands/blocks.rs b/src/app/commands/blocks.rs index dbf4a8f3c..4a2a2bc68 100644 --- a/src/app/commands/blocks.rs +++ b/src/app/commands/blocks.rs @@ -612,8 +612,8 @@ impl OpenCADStudio { // ATTSYNC : the named block, without prompts. cmd if cmd.starts_with("ATTSYNC ") => { let arg = cmd.trim_start_matches("ATTSYNC").trim().to_string(); - let table = - crate::modules::insert::block_cmdline::BlockTable::of(&self.tabs[i].scene.document); + let document = &self.tabs[i].scene.document; + let table = crate::modules::insert::block_cmdline::BlockTable::of(document); match table.attributed.iter().find(|b| b.eq_ignore_ascii_case(&arg)) { Some(block) => { let block = block.clone(); @@ -1725,27 +1725,14 @@ mod tests { } // ATTMAN and BATTMAN are the Block Attribute Manager; this build routes both - // to the attribute editor (ATTEDIT) instead of the old command-line listing. - // With nothing selected they start the same interactive pick as ATTEDIT, - // byte for byte, and never emit the old "no matching block" listing text. + // to the attribute editor (ATTEDIT). A drawing without attributed blocks + // has nothing to manage, which both report instead of opening it. #[test] - fn attman_and_battman_route_to_attedit() { - let attedit = run_capture(&mut fresh_app(), "ATTEDIT"); - let attman = run_capture(&mut fresh_app(), "ATTMAN"); - let battman = run_capture(&mut fresh_app(), "BATTMAN"); - - assert_eq!( - attman, attedit, - "ATTMAN must behave like ATTEDIT, got: {attman:?} vs {attedit:?}" - ); - assert_eq!( - battman, attedit, - "BATTMAN must behave like ATTEDIT, got: {battman:?} vs {attedit:?}" - ); - assert!( - !attman.contains("no matching block"), - "ATTMAN must not run the old command-line listing, got: {attman:?}" - ); + fn attman_and_battman_report_a_drawing_without_attributed_blocks() { + for command in ["ATTMAN", "BATTMAN"] { + let output = run_capture(&mut fresh_app(), command); + assert_eq!(output, "This drawing contains no attributed blocks.", "{command}"); + } } #[test] diff --git a/src/app/update/file.rs b/src/app/update/file.rs index 57ff98f6e..7356ee7c1 100644 --- a/src/app/update/file.rs +++ b/src/app/update/file.rs @@ -799,7 +799,9 @@ impl OpenCADStudio { attdef_on_screen: crate::modules::draw::draw::attdef::session().on_screen, block_base_on_screen: block_defaults.base_on_screen, block_objects_on_screen: block_defaults.objects_on_screen, - block_object_mode: crate::modules::insert::block_cmdline::mode_code(block_defaults.mode), + block_object_mode: crate::modules::insert::block_cmdline::mode_code( + block_defaults.mode, + ), block_allow_exploding: block_defaults.allow_exploding, block_open_in_editor: block_defaults.open_in_editor, wblock_object_mode: crate::modules::insert::block_cmdline::mode_code( @@ -2439,7 +2441,11 @@ impl OpenCADStudio { d.header.insertion_units = unit; d } - crate::modules::insert::block_cmdline::WblockSource::Objects { handles, base, .. } => { + crate::modules::insert::block_cmdline::WblockSource::Objects { + handles, + base, + .. + } => { crate::modules::insert::wblock::extract_entities_to_doc_with_base( &document, &handles, base, unit, ) diff --git a/src/app/update/mod.rs b/src/app/update/mod.rs index d48e535b0..93e428ff5 100644 --- a/src/app/update/mod.rs +++ b/src/app/update/mod.rs @@ -6082,7 +6082,9 @@ impl OpenCADStudio { crate::modules::insert::block_cmdline::defaults().wblock_mode = mode; self.persist_settings_if_changed(); let source = match state.source_mode { - WblockSourceMode::Block => WblockSource::Block(state.block_name.trim().to_string()), + WblockSourceMode::Block => { + WblockSource::Block(state.block_name.trim().to_string()) + } WblockSourceMode::EntireDrawing => WblockSource::Drawing, WblockSourceMode::Objects => WblockSource::Objects { handles: state.selected_handles.clone(), diff --git a/src/modules/insert/block_cmdline.rs b/src/modules/insert/block_cmdline.rs index 0ff3810fe..271b43718 100644 --- a/src/modules/insert/block_cmdline.rs +++ b/src/modules/insert/block_cmdline.rs @@ -511,7 +511,8 @@ pub enum WblockSource { } /// -WBLOCK: `Enter name of output file:` → (replace?) → -/// `Enter name of existing block or [= (block=output file)/* (whole drawing)] :` +/// `Enter name of existing block or [= (block=output file)/* (whole drawing)] +/// :` /// → `Specify insertion base point or [mOde]:` → `Select objects:`. pub struct DashWblockCommand { step: WblockStep, diff --git a/src/scene/block_base_point_tests.rs b/src/scene/block_base_point_tests.rs index 230eb8da3..b02a6e2cb 100644 --- a/src/scene/block_base_point_tests.rs +++ b/src/scene/block_base_point_tests.rs @@ -643,7 +643,7 @@ fn locked_noop_redefine_leaves_the_instance_where_it_is() { fn locked_block_definition_dialog_prefills_the_existing_definition_base_point() { // base-point fix (D): choosing an existing block in the Block Definition dialog // prefills the base point from that definition, so a redefine starts from - // the base it already has. A new block still starts at 0.0000. + // the base it already has. A new block starts at 0. let scene = scene_with_bp_test(); assert_close( block_base_point(&scene.document, BP_TEST), @@ -652,11 +652,11 @@ fn locked_block_definition_dialog_prefills_the_existing_definition_base_point() "the drawing's block base point", ); - // A new block: the fields stay at 0.0000. + // A new block: the fields start at 0. let fresh = BlockDefinitionState::new(vec![BP_TEST.to_string()], Vec::new(), 0); - assert_eq!(fresh.base_point_x, "0.0000"); - assert_eq!(fresh.base_point_y, "0.0000"); - assert_eq!(fresh.base_point_z, "0.0000"); + assert_eq!(fresh.base_point_x, "0"); + assert_eq!(fresh.base_point_y, "0"); + assert_eq!(fresh.base_point_z, "0"); assert_eq!(fresh.parse_base_point(), DVec3::ZERO); // Picking the existing block (what `Message::BlockDefNameSelect` does). diff --git a/src/sys.rs b/src/sys.rs index 85d5b778b..f183738aa 100644 --- a/src/sys.rs +++ b/src/sys.rs @@ -1380,7 +1380,8 @@ pub fn documents_dir() -> Option { let mut raw: windows_sys::core::PWSTR = std::ptr::null_mut(); // SAFETY: SHGetKnownFolderPath writes a CoTaskMemAlloc'd, NUL-terminated // wide string to `raw`, freed below. - let hr = unsafe { SHGetKnownFolderPath(&FOLDERID_Documents, 0, std::ptr::null_mut(), &mut raw) }; + let hr = + unsafe { SHGetKnownFolderPath(&FOLDERID_Documents, 0, std::ptr::null_mut(), &mut raw) }; let path = if hr == 0 && !raw.is_null() { // SAFETY: `raw` is a valid NUL-terminated wide string from the call above. let len = unsafe { (0..).take_while(|&k| *raw.add(k) != 0).count() };