forked from 1b-agent/opencadstudio-upstream
Avoid slicing text inside multi-byte characters
Right-to-left line reordering walked each atom's byte range and sliced the line at every byte, panicking when a neutral multi-byte character such as a guillemet preceded the first strong character. Walk characters instead. FIND/FINDALL located the REPLACE keyword in a Unicode-uppercased copy and sliced the original with that offset; uppercasing can change byte length (dotless i, ligatures). Uppercase ASCII only, which keeps offsets aligned. FILLET and CHAMFER inline R/D shorthands now test the original text before slicing past the first character. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
1 parent
ef0c6bf403
commit
38aa2ee34d
3 files changed
+32
-6
No files matched your search
@@ -1514,7 +1514,7 @@ impl CadCommand for FilletCommand {
|
||||
return Some(CmdResult::NeedPoint);
|
||||
}
|
||||
// "R 5.0" inline shorthand
|
||||
if upper.starts_with('R') {
|
||||
if t.starts_with(['r', 'R']) {
|
||||
let body = t[1..].trim();
|
||||
if let Some(v) = crate::entities::common::parse_typed_length(body) {
|
||||
if v >= 0.0 {
|
||||
@@ -2109,7 +2109,7 @@ impl CadCommand for ChamferCommand {
|
||||
return Some(CmdResult::NeedPoint);
|
||||
}
|
||||
// "D 5.0" or "D 5.0 3.0" inline shorthand
|
||||
if upper.starts_with('D') {
|
||||
if t.starts_with(['d', 'D']) {
|
||||
let body = t[1..].trim();
|
||||
let parts: Vec<f64> = body
|
||||
.split_whitespace()
|
||||
|
||||
Reference in new issue
Block a user