From f830084be7f92c0ddbfd77f80166fe31bb949dca Mon Sep 17 00:00:00 2001 From: ramox81 <184937705+ramox81@users.noreply.github.com> Date: Fri, 2 Oct 2026 10:14:54 +0300 Subject: [PATCH] FIELD: codec field fixes, six-decimal real system variables Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/entities/field.rs | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6996f8143..4283e181f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4206,7 +4206,7 @@ dependencies = [ [[package]] name = "opencadcodec" version = "0.5.5" -source = "git+https://github.com/ramox81/cadcodec.git?rev=22a5c3e#22a5c3e07bf9eda6b7937e951906f8aa53fdeaf3" +source = "git+https://github.com/ramox81/cadcodec.git?rev=595800e#595800ed4b778827c3c9e48245cade9cd8ccc05a" dependencies = [ "ahash 0.8.12", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index c9b2a9433..a8045c25d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -92,7 +92,7 @@ objc2-foundation = { version = "0.2", features = ["NSArray", "NSURL", "NSString" # Field authoring API and field format codes (opencadcodec PR pending). [patch."https://github.com/HakanSeven12/opencadcodec.git"] -opencadcodec = { git = "https://github.com/ramox81/cadcodec.git", rev = "22a5c3e" } +opencadcodec = { git = "https://github.com/ramox81/cadcodec.git", rev = "595800e" } [patch.crates-io] iced_core = { git = "https://github.com/iced-rs/iced.git", rev = "23604ff22ab0aad9e00b9327cb7b8546ed84db39" } diff --git a/src/entities/field.rs b/src/entities/field.rs index 9cd0cf4c7..19a12cca9 100644 --- a/src/entities/field.rs +++ b/src/entities/field.rs @@ -101,9 +101,10 @@ pub const SYSVARS: &[&str] = &[ "userr4", "userr5", ]; +/// Real system variables show six decimals, as the reference shows them +/// (TEXTSIZE 2.500000). fn num(v: f64) -> String { - let t = format!("{v:.4}"); - t.trim_end_matches('0').trim_end_matches('.').to_string() + format!("{v:.6}") } /// A system variable's value as a field shows it.