mirror of
https://github.com/storytold/cadcraft.git
synced 2026-11-10 20:40:30 -06:00
* FIND: report the text around each match The result list needs to show what matched, not just its handle, so each entry now carries a snippet of the text around the first hit, the hit's offset in it and its length. Offsets count characters, not bytes, so a Chinese or Vietnamese drawing never splits a glyph. Two optional parameters let a window search part of the space: `types` narrows the search by object type name and `handles` limits it to the objects a caller has already listed, which is what makes replacing a single row possible. Both default to the old behaviour, so scripts, LISP and the MCP server get the answer they always got. * FIND: a Find and Replace window FIND only had a command line: it asked for the text, ran, and printed a count, and the palette's Find and Replace tile opened the same prompt. The answer lived in the drawing and the place to read it was the command line. This adds a window behind the same command. The result list shows each object with the hit lit up, a click selects that object and zooms to it, Replace edits the row under the cursor and Replace All the rows on the list. The window stays open while the drawing is edited, because finding and replacing is a loop: look, locate, edit, look again. A JSON call carries its parameters, so scripts, LISP and the MCP server still get the engine's answer; only the bare command opens the window. Cmd+F reaches it from anywhere, and the twenty labels it adds are in every interface language. * FIND: clear the window's state when it closes or the drawing changes The result rows hold handles, and a handle only means something in the drawing it was found in. The state now lives exactly as long as the window does, and an epoch change while the window sits open clears the rows instead of letting Replace All edit an object the search never matched. A successful replacement keeps the engine's replacement report rather than letting the re-search overwrite it with a match count. * FIND: an empty replacement is a deletion, and stale rows die on any change Replacing with nothing deletes the matched text, which is a legitimate replacement, so the buttons no longer require text in the Replace field. The result rows answer one question - this text, with these switches, in this drawing and space. Editing the search term or either switch now clears the rows and owes a fresh search, and so does switching between model space and a layout: a handle means nothing outside the space it was found in. * rustfmt: sort the module list after the merge Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Brandon Thomas <echelon@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>