mirror of
https://github.com/storytold/cadcraft.git
synced 2026-12-02 02:38:30 -06:00
b21747b30bc47caa2db3f632480fe855e5df659f
10
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
7064a685a8 |
Greek: commands, aliases and prompt keywords typed with the Greek layout, and 46 missing Greek rows (#2722)
**What**
Typing a command with the Greek keyboard layout active (ΛΙΝΕ for LINE, ΜΙΡΡΟΡ for MIRROR) now works like typing the Latin name, in four places: starting a command, answering a prompt keyword (ΘΝΔΟ = Undo), the selection words at "Select objects" (ΑΛΛ = ALL), and command-line AutoComplete. The layout puts each Greek letter on the key of the Latin letter it sounds like (θ on U, ψ on C, ω on V, Q types `;`, W the final sigma), so `keyboard::latin_keys` maps letter by letter and ignores accents, including a combining tonos or dialytika straight after its letter. It returns `None` for a word with no Greek letter, so Latin input is never touched. ASCII characters in a Greek word are kept, in lower case (the dash of `-ΛΑΥΕΡ`), and a word with any other character is not read as Latin keys.
A command the interface handles itself answers to its Greek-typed name too: ΨΛΟΣΕ asks about unsaved changes as CLOSE does, `;ΣΑΩΕ` opens the Save picker for a drawing without a file, ΛΑΥΕΡ opens the Layers dialog.
What keeps existing behaviour:
- A word that is already a command, alias or LISP function keeps its own meaning, as typed or in another case or accent (a Greek `(defun c:ΛΙΝΕ …)` runs as itself, also when typed λινε).
- A keyword a prompt offers in its own Greek spelling (a LISP program's list) wins over its Latin reading, with Greek case folded.
- A selection word wins over a keyword on the same key, as it does for Latin typing: at COUNT's "Select object to count or [List/Spaces]", Λ is Last, like L.
- A name that exists wins over the keyword or selection word its keys spell: an existing block at BEDIT's "block name or select" and at BLOCKREPLACE's two name prompts (a block called Μ opens at BEDIT, it is not Multiple), and a loaded hatch pattern at HATCH's pattern prompt (a pattern called ΣΟΛΙΔ is that pattern, not Solid). The name is found in any case or accent and the command gets it as stored.
- Only the lookup reads the Greek keys: text that is no selection word reaches the command as typed (a Greek block name at BEDIT's "block name or select"), and an unknown Greek command is reported as typed.
Known and accepted:
- At a prompt that takes a name and offers a keyword, a Greek word whose keys spell the keyword is the keyword while no block has that name (Σ is Select at BLOCKREPLACE), as the Latin `S` is there.
- Two aliases whose Greek names differ only in case or accent can both exist (the alias editor folds ASCII only). Each runs when typed as stored; another spelling of the word runs the first of them in the store's order.
- Object snap overrides and the other point modifiers (END, FROM, M2P, TT, TK, `.X`) are not read from Greek-layout typing. They need the Latin layout, as before.
- Calls by command id are unchanged: a `cmd {json}` line and `execute` (control channel, MCP) do not read a Greek-typed name.
- In a script a line that starts with `;` is still a comment, so a line `;ΣΑΩΕ` there is not QSAVE.
Also adds 46 `el.tsv` rows for strings that were in the source but missing from the catalog when the rows were written (alias editor, save-on-close and units dialogs, a few menu and command labels). On this head the i18n report lists 39 strings that fall back to English for `el` (mostly keyboard shortcuts, right-click customization and alias import); they are not in this PR. Four command labels keep the English name in parentheses, like the rest of the catalog. The `el.tsv` row of `ATTRIBUTION.md` credits these rows (AI-assisted, read by the contributor, a native Greek speaker), and `contributors/people.toml` has the author's entry.
**Tests**
- `keyboard::tests`: the mapping, non-Greek words left alone, combining marks only straight after a Greek letter, one Greek word in any case, accent or final sigma, a character the layout does not type is no spelling of a Greek letter (the micro sign is not μ), 100 000-letter and malformed input do not panic
- `engine/tests/it/greek_keyboard.rs`: ΛΙΝΕ draws a line (lower case and accents too), `;ΣΑΩΕ`, an unknown Greek word is reported as typed, the selection word ΑΛΛ, Λ, λ and ΛΑΣΤ at COUNT's prompt count like L (Last, not the List option), keywords at MIRROR's prompt (Ν is read as No and keeps the sources, Υ erases them), a Greek LISP command runs as itself and in any case or accent, a Greek block name at BEDIT reaches the command as typed, a block called Μ opens at BEDIT (in either case), a block called Σ at BLOCKREPLACE, a loaded pattern called ΣΟΛΙΔ at HATCH's pattern prompt (upper case, lower case, accented)
- `engine/tests/greek_keyboard_aliases.rs` (its own binary, the alias store is process-global): a Greek alias keeps its meaning, as typed and in any case or accent; a word of 1 000 000 Greek letters is looked up among 5 000 Greek aliases within 5 s (170 s before the word was folded once per lookup)
- `prompt::tests`: a Greek keyword is matched as spelled, before its Latin reading
- `ui-egui`: ΨΛΟΣΕ asks before it closes a drawing with unsaved changes, and a LISP `c:ΨΛΟΣΕ` still runs as itself; ΛΑΥΕΡ (also λάυερ) opens the Layers dialog and `;ΣΑΩΕ` the Save picker; AutoComplete reads a Greek prefix as Latin keys, offers the Greek alias that Enter would run, and leaves a Greek word the drawing's LISP defines as typed
- Each fix after review landed with a test that failed before it.
**What ran** on
|
||
|
|
e43c39c55e |
Selection and grips respect the layers frozen in the active viewport (#3055) (#3124)
Fixes #3055. ## What Inside an MSPACE viewport an object on a layer frozen in that viewport (VPLAYER, VP Freeze) is not drawn, but it could still be picked, window-selected and edited through the viewport, and a selected one kept its grips. `Drawing::is_visible` has no viewport, and selection and grips asked only that. Three questions now take the active viewport into account: - `select::selectable(d, e, frozen)`: what a selection can take. `frozen` is `DocState::viewport_frozen()`, the layers frozen in the active MSPACE viewport (empty in paper space and on the Model tab). The selection functions have `_in` variants that take it (`pick_in`, `pick_all_in`, `select_window_in`, `select_fence_in`, `select_polygon_in`, `select_group_in`, `SelectMode::select_in`); the existing functions keep their signatures and select as before. - `DocState::shows(e)`: what the view being edited shows, `is_visible` plus the active viewport. Grips ask it where #3048 made them ask `is_visible`. - `Session::selection()`: the selection as the view being edited has it, without the model-space objects the active viewport does not draw (`DocState::shown_selection`). The stored selection, `DocState::selection`, keeps them. **Selecting.** Every selection made in the space being edited passes the active viewport's frozen layers: - idle clicks and windows, "Select objects" (a pick, the implied window, W, C, BOX, F, WP, CP, ALL, G, and L and P, which take the last object the viewport draws and the part of the Previous set it draws), selection cycling, and prompts that pick one object; - `select`, `selectall`, `selectsimilar`, and the group members a pick brings (PICKSTYLE); - the commands that select for themselves: STRETCH (JSON and typed, with its own All, Last and Previous and its multiline vertex rule), TRIM and EXTEND by fence and by crossing window; - AutoLISP `ssget` (W, C, F, WP, CP, a point, P, L) and `entsel`; - in the UI, the rollover highlight and the hatch under the cursor that a double-click edits. The object under the cursor and selection cycling's badge are worked out again when the active viewport's frozen layers change under a pointer that does not move. **Already selected.** An object that is selected when its layer is frozen in the active viewport stays in the stored selection until the selection is replaced or cleared, and counts as selected again once the layer is thawed there. Until then `Session::selection()` leaves it out, and with it everything that starts from the selection: the selection made before a command (PICKFIRST), a JSON command that names no objects, Delete, the grip edits that cover the selection, AutoLISP's implied selection (`ssget`, `ssget "I"`, `ssgetfirst`), the palettes, and what the session reports as the selection (`summary`, `drawing.inspect`). Two UI functions read the stored selection themselves and now read `shown_selection` too: the hatch editor's edit mode and BEDIT's choice between editor and dialog. The selection highlight inside the active viewport leaves the object out as well. Adding to the selection or removing from it (a click, a window, `select` with `add` or with nothing to select with, QSELECT appending) starts from the stored selection (`Session::stored_selection()`), so such an object is not dropped while the selection changes around it. A command that takes the selection, or a new selection, replaces it as before. `Session::selection()` gives the stored selection unchanged wherever the active viewport hides none of the selected objects: in paper space, on the Model tab, and in a viewport that freezes no layer. The UI asks for the selection several times a frame, so `DocState::drawn_in_viewport` does not look every selected object up: a few handles are looked up one by one, and beyond that it passes over model space once. **Grips.** Static grip painting and hit testing, hot grips (`click_grip`), the grip edit's targets and the typed GRIP command (`griphot.rs`), and dynamic grips ask `shows`. The dynamic-grip cache key now holds the active viewport's frozen layers: entering another viewport changes which references are shown without changing the drawing revision, so the key did not change. The grip code asks for itself, as it does for `is_visible` since #3048, so it does not depend on who hands it the objects. A viewport's frozen layers hide model-space objects only, never an object on the sheet. Layer names are compared the way the renderer compares them. Outside a viewport, and in a viewport that freezes no layer, nothing changes. ## Test The tests build two viewports on one layout, one of which freezes a layer. Most take the same path through both: through the viewport that freezes the layer the object on it is left out, through the other one it is taken as before. The ones about an object that is already selected freeze and thaw its layer in the viewport being edited. `crates/engine/tests/it/viewport_frozen_selection.rs`, 22 tests: - selecting: a pick, window / crossing / fence, idle clicks and windows, selection cycling, every answer to "Select objects" (with ERASE), group members, `selectall` and `selectsimilar`, STRETCH (JSON; typed crossing window, All, a pick, Last, Previous; the multiline vertex rule), TRIM by fence and by crossing window, a prompt for one object (BREAK), LEADER's Copy, AutoLISP `ssget` and `entsel`; - already selected: a typed command with PICKFIRST, a JSON command without handles and Delete; Previous and Last; the grip edits that cover the selection; what the session reports, with paper space and the Model tab unchanged; adding to and removing from the selection; a small and a large selection (the two paths of `drawn_in_viewport`, in a drawing whose draw order is not the order of its handles); - grips: a shared grip, the grips of an object whose layer is frozen and thawed again while it is selected, and what the edited view shows (model-space objects only, never an object on the sheet). `crates/ui-egui`, 9 unit tests (hot grips, the grip and the hatch under the cursor, the viewport highlight, dynamic grips and their cache key, BEDIT's choice, the hatch editor's edit mode, selection cycling's badge under a resting pointer) and `tests/viewport_frozen_grips.rs`, 3 tests (no grips painted for a selected object the viewport does not draw; the rollover highlight; the highlight under a resting pointer while the layer is frozen and thawed). EXTEND runs TRIM's selection code and has no test of its own. Without the change these tests fail, checked call by call with a temporary switch that is not in this PR: each of the 60 calls of `viewport_frozen`, `shows`, `hidden_in_viewport`, `drawn_in_viewport`, `shown_selection`, `last_in` and `stored_selection` outside tests was put back to the old behaviour on its own. 51 of them made at least one test fail directly; 5 grip checks that sit behind `Session::selection()` did so with the getter switched back as well; the other 4 are calls inside `DocState` that the same tests reach through their callers. Each path of `drawn_in_viewport`, and its sort, fails a test when switched off. Of the 42 calls of `Session::selection()`, 10 have a test that fails when that one call reads the stored selection; the other 32 receive the same list and have no test of their own. The second commit's two conditions (the hover and the badge under a resting pointer) each have a test that fails without them. ## What ran The seven steps of `cargo xtask ci`, one by one, on this branch at |
||
|
|
cbc9db75b1 |
Merge remote-tracking branch 'upstream/main' into pr/dview
# Conflicts: # crates/engine/src/prompt.rs # crates/engine/src/session/execute.rs # crates/io/src/dxf_read/entities.rs # crates/ui-egui/src/canvas.rs # crates/ui-egui/src/cmdline.rs |
||
|
|
5e9c478bfb |
U inside a LISP routine takes back the routine's last command (#2610)
Inside a routine, commands recorded no undo step (the routine becomes one when it ends), so U inside a routine took back the step from before the routine: after drawing a line D, ERASE B then U in one routine brought B back and removed D. As AutoCAD 2024 does (accoreconsole, the drawing read back after one routine), U inside a routine now takes back the routine's last command, with what the routine did after it (entdel, entmake); U again, UNDO n and REDO go on through its commands. With none left, U takes back the drawing's step before the routine, as before, and the routine's step then starts from there. Once the routine ends it is still one undo step. The routine's steps live in the session's LISP state (RoutineSteps), not in the drawing's undo stack, so a long routine doesn't push the drawing's earlier steps out. A command inside the routine ends what REDO could bring back; UNDO Control One and None apply. DocState::swap_in is the one restore step undo, redo and the routine share. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
04e74a165c |
Panic hunt covers every command, and a panic after a command restores the drawing (#2517)
panic_hunt runs every command in a fresh session and fails on real panics. The guard now covers the steps after a command, so a late panic restores the drawing instead of ending the app. |
||
|
|
3ba2362ec9 |
LISP: entity names answer prompts that pick one object (#2477)
* LISP: entity names answer prompts that pick one object `command` fed an entity name, alone or as `entsel` returns it (name and point), to the running command as a pick. Prompts that pick a single object with a point (MEASURE, DIVIDE, LENGTHEN, PEDIT, BREAK, TRIM and EXTEND in Standard mode, FILLET, OFFSET, REVCLOUD Object, dimensions…) only take points, so routines got "Invalid input" or nothing at all. At such a prompt the name is now entered as its point, and a pick at exactly that point finds the named object (Session::pick_object), so the point says where on it, as in AutoCAD. A bare name stands at the object's DXF group 10 point, the point AutoCAD picks it at: a line's start, a circle's or an arc's centre, a polyline's first vertex. At an arc's centre MEASURE runs from the arc's end, as AutoCAD does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep a named object for its own input and its own space A name given at a prompt picking one object now holds only while that input is taken: a later pick at the same point finds what lies there. A name for an object in another space picks nothing, instead of the object under its point in the current space. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e1d0a4747e | Fix imports after merging upstream/main | ||
|
|
b7c62eb93d |
Merge remote-tracking branch 'upstream/main' into pr/dview
# Conflicts: # crates/doc/src/entity.rs # crates/engine/src/cmd/layout.rs # crates/engine/src/cmd/modify2.rs # crates/engine/src/lib.rs # crates/io/src/dxf_read.rs # crates/io/src/dxf_write.rs # crates/render/src/lib.rs # crates/ui-egui/src/canvas.rs # docs/gaps.md |
||
|
|
2721aa8982 |
Enforce Rust coding standards via Clippy (#2239)
* chore(clippy): enforce workspace Rust quality gates * refactor(doc): use explicit entity imports * refactor(constraints): split residual evaluation * refactor(fonts): split mtext layout * refactor(render): use explicit entity imports * fix(fonts): retain height for empty paragraphs * fix(doc): repair dimension and dynamic block links * refactor(render): split entity drawing helpers * docs: document workspace lint inheritance * refactor(render): isolate dimension geometry * refactor(engine): use explicit imports * refactor(engine): split complex edit paths into helpers * refactor(io): split DXF read and write helpers * refactor(ui): split canvas interaction and drawing * refactor(ui): split command and drawing helpers * test(i18n): split locale preference checks * fix(ui): use current egui scope id API * fix(dim): preserve text offset and ellipse grip behavior |
||
|
|
7d2ca90783 | refactor(engine): move Session methods from session.rs to session/ |