Resolve the MTEXT conflicts with #3197 (jayzed80's #2952 fix) on the
shared tokenizer: Token::Unknown is now shown as typed (backslash kept,
code read as text) in plain_mtext, the layout parser and the paragraph
scan, matching main's behaviour. Drop the now-unneeded too_many_lines
expectation on parse.
AutoCAD 2024 shows a \U+ without four hex digits, a malformed \M+ and an
unknown code such as \Z as typed, backslash included. plain_mtext, the
layout and the paragraph scan dropped the backslash and the code instead.
They now keep the backslash and read on from the code.
**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 e171e083, `cargo xtask ci` step by step: `cargo fmt --all -- --check` and `cargo clippy --workspace --all-targets -- -D warnings` clean; `cargo test --workspace --lib --bins --tests --no-fail-fast`: 3759 passed, 0 failed, 28 ignored; the doctest step (the workspace has no doctests), the i18n report, `cargo xtask assets`, `cargo xtask layers` and `cargo xtask wasm` passed. The same steps passed on e171e083 merged with main at e1d379ad, a local merge that is not pushed: 3761 passed, 0 failed, 28 ignored.
Main is merged in. The merge commit e3b3a2e0 had kept only this branch's side of `cmd/file.rs` and `cmd/file/pgp.rs`; e8a79d19 restores main's alias-persistence helpers and exports next to `greek_alias`, so those two files are main's again plus this PR's own lines.
**Docs (not edited here, per AGENTS.md)**: `docs/localization.md` "Greek (`el`) interface" and `docs/localization-parity.md` row "Greek | el" (its row count) could mention that commands typed with the Greek layout are accepted.
Nothing here is Autodesk-derived: the mapping is the standard Greek layout, written from the layout itself.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **New Features**
* Greek keyboard-layout input is recognized as Latin keystrokes when entering commands, aliases, autocomplete prefixes, selection keywords, and prompt options.
* Greek commands and aliases can be matched across case and accent variants. Existing commands, aliases, and matching block names take precedence over Greek-layout interpretations; unrecognized input retains its original text.
* At prompts that accept either a block name or a selection keyword, Greek input is treated as a name when a matching block exists; otherwise, it can be interpreted as a selection keyword.
* Greek-layout input can also match loaded or built-in hatch pattern names, which take precedence over prompt keyword interpretation.
* In BLOCKREPLACE prompts, you can select a block reference to choose a block.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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 6754b960 (main at ddfa833b plus its two commits):
fmt, clippy (workspace, all targets, `-D warnings`), test (3725 passed, 0 failed, 26 ignored; the doctest
step ran, the workspace has no doctests), the i18n report, assets, layers and wasm. All pass.
## Not in this PR
- A selected object whose layer is turned off or frozen for the whole drawing is still taken by a command that
starts from the selection, as before (ran: ERASE and MOVE typed and as JSON, and Delete, edit it). The issue asks
to keep the drawing-wide behaviour, so this PR leaves it alone.
- A command that is given object handles (`handles` in JSON, an entity name from AutoLISP) acts on them as before,
whatever the viewport draws. QSELECT and `ssget "X"` look at the whole drawing; what they put in the stored
selection is then left out like any other selected object the viewport does not draw.
- `ssget "L"` takes the last object of any space, as before; inside a viewport it now passes over the objects
that viewport does not draw.
- Object snap, hatch boundary detection, the implied cutting edges of TRIM and EXTEND, constraint inference, and
the Z that ID and DIST read from an object under the point are not selections and are unchanged.
- A block reference on a layer the viewport draws, with parts on a layer frozen in the viewport: the parts are not
drawn, but the hit geometry of a reference is built without the viewport, so a pick where such a part would be
still finds the reference. Ran on eaae189f with a test that is not in the PR: a pick, a crossing window and a
fence on such a part select the reference, and a window around the drawn part alone does not; with the layer
frozen for the whole drawing it is the other way round. It needs extents that know the viewport, which
`crates/doc` does not have, so it is left for its own change.
- Visibility that changes while an interactive command is already waiting, or while a grip list is open, is #3056.
## Compared with AutoCAD 2022
Observed as a black box, in a drawing made there for this and driven by a script: two lines, one of them on a layer
frozen (VPLAYER) in one of two layout viewports. No file from it is in this PR.
Inside the viewport that freezes the layer, the same there and here: a pick, a window, a crossing window, a fence
and a crossing polygon (`ssget`), ALL, Last, a crossing window and a fence at "Select objects", `ssget "L"`, select
all, and STRETCH's crossing window leave the object out; `ssget "X"` returns it; a command that is given the object
itself (its entity name there, `handles` here) changes it. Through the other viewport the pick, the windows, the
fence, ALL, Last and STRETCH took it.
Different, where the issue asks for more ("cannot be edited through that viewport, including when they were
already selected"):
- An object selected through the other viewport stays in the implied selection when the viewport that freezes its
layer becomes the active one (`ssgetfirst`, `ssget "I"`), and ERASE typed there erased it. Here the commands leave
it out.
- Previous: `ssget "P"` returned the set made through the other viewport whole, and CHPROP with Previous changed
the object. Here Previous takes the part of that set the viewport draws.
A comment on the issue asks which of the two is wanted. This PR follows the issue as written; if AutoCAD's
behaviour is preferred for these two cases, I will change them here.
Not observed there: grips (a script cannot read them), and freezing the layer while objects are selected (VPLAYER
is a command and cleared the selection).
## Parity rows
U5 (grips) and F15 (viewports) in docs/gaps.md. No docs edited.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **New Features**
* Selection, picking, hover highlighting, and grip interactions now respect layers frozen in the active model-space viewport.
* Selection reports and editing tools show only objects visible in the active viewport, while stored selections retain hidden objects.
* Window, crossing, fence, point, and other selection modes now apply viewport visibility consistently.
* **Bug Fixes**
* Changing viewports or freezing and thawing layers now updates selection highlights, hover targets, and grips to match what the active viewport displays.
* Selection commands and object inspection now consistently reflect viewport visibility.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
An INSERT repeated in rows or columns (groups 70/71 above 1) was written with
the subclass marker AcDbBlockReference, the marker of a single block
reference. Readers that go by the marker, BricsCAD among them, then drew only
the first copy of the array. The writer now marks such a reference
AcDbMInsertBlock, as AutoCAD does, and a plain INSERT keeps
AcDbBlockReference. The reader does not look at the marker, so CADCraft reads
both back as before.