Skip to content

Lasso: an enlarged selection keeps its erasing and its white ink in scale, and a lasso round only erased ink selects nothing (#204, #205) - #206

Open
ganten1998 wants to merge 3 commits into
mainfrom
204-lasso-resize-and-empty
Open

ganten1998 wants to merge 3 commits into
mainfrom
204-lasso-resize-and-empty

Conversation

@ganten1998

Copy link
Copy Markdown
Collaborator

Two small lasso changes found during the work on #187.

A resize keeps the erasing and the white ink in scale (#204)

Before. A resize by a corner handle put the group down with its points scaled and every width kept in mm: black ink, white ink and the erasing carried with the ink alike (translated in rust/src/lasso.rs copies the stroke's parameters as they are). Made larger, the erasing no longer covered all the ink it had erased: a word erased in three passes, the page made 1.1 times as large, showed faint traces of the word after Done (the halo outlined them), dark ones at 1.5 times, and a line cut by close strokes of white ink showed through between them. Made smaller, the erasing took away ink that showed: a cut kept its width while the line around it shrank.

Now. lasso_scale_widths (lasso.rs) scales size_min_mm and size_max_mm of every stroke of the group by the resize's factor, black ink, white ink and erasing alike, and sel_place calls it for a resize (a move's spot has scale 1). The group is put down as a picture of itself, larger or smaller.

  • Black ink now grows and shrinks with the selection too (a word made 1.5 times as large is drawn with lines 1.5 times as thick). That is what lets white ink do exactly what black ink does, and the page look as the selection did.
  • Shrinking scales the widths down as well. Both directions keep erased parts erased and visible parts visible, and a resize undone by the opposite one gives the widths back. With the widths kept when shrinking, a cut kept its width and took away ink beside it that had showed (at half size, a 2 mm eraser's cut stayed 20 px wide where 10 px is the cut scaled; in the scenario, none of the marker line beside the cut was left, against 90 dark pixels each side now).
  • A limit: a width stays within 0.1 to 12 mm, the range page_parse clamps a page file's widths to and the brush draws, so a stroke reads back as it was put down. Erasing that would be wider than 12 mm is drawn 12 mm wide: the default eraser's marks (8 mm at full pressure) stop growing past 1.5 times, so a word erased with little room to spare can show traces at the edge of its erasing after a larger resize (measured: at 2 times with the default eraser, the loop bottoms of a word erased with a few pixels to spare came back). Raising the limit would change what earlier versions draw of the page, so it is left.
  • Not exactly scale-free: the brush's soft edge is about a pixel wide at any size and a width has a 0.1 mm floor, so single pixels can remain between close strokes of a thin white pen. In a gap cut by five strokes of a white fountain pen (shots of the headless panel against the blank page): 3 pixels at 1.1 times (2 more than 32 levels off the paper), 5 at 1.5, 6 at 0.6 and 7 at 0.4, none darker than mid-gray, so display.dark and the halo see none. Before, 9 and 45 at 1.1 and 1.5 times (the darkest 151 and 56), and none at 0.6 and 0.4, where the white ink kept its width and so was relatively wider.
  • Undo is unchanged: the step keeps the removed and the added strokes whole. Scoped erasing: a floor is still decided plain or scoped from the strokes as they are put down, now with their scaled widths, so erasing made larger over ink outside the selection is scoped and leaves that ink as it was.
  • A paste scaled to fit a smaller page keeps the widths in mm, as scale_page does (LASSO-DESIGN.md row 4).

A lasso round only erased ink selects nothing (#205)

Before. The lasso takes every ink stroke inside it, and ink erased wholly stays in the page file under its erasing until compaction, so a lasso round only such ink selected it: no halo since #187, a box round nothing, and a bar whose Copy copied nothing.

Now. plan_shows (rust/src/editor/select.rs) tells whether the page shows any of the ink a lasso takes, its strokes taken whole and its exact-area pieces, by the halo's own rule: shown_of, the one function both use (the page as drawn, stroke_shown_runs, else the estimate). In other words: would the selection have a halo anywhere. What the preview found for the page as it is is read first; the first stroke that shows ends it. When none shows and no link comes with it, the lasso selects nothing and says "Nothing to select.", the toast of a lasso round empty paper. The bar's mode button does the same when the lasso judged again in the other mode takes only such ink (the selection goes, Select mode stays).

  • Beside ink that shows, erased ink is selected as before, so Copy, Cut and Delete behave as they did.
  • A lasso that takes a link keeps the selection, erased ink and all: the link shows (its area drawn dashed), and the link rules are unchanged (a link goes with every ink stroke inside its area, so a lasso round erased ink inside a link's area brings the link).
  • No new strings.

Tests, and how each was shown to fail

  • test_lasso a_resize_scales_widths_with_the_group (new): a word erased by two passes of a 3 mm eraser with a pixel or two to spare, a line cut by a 2 mm eraser and a line cut by five strokes of white ink, lifted and put down at 1.1, 1.5, 2 and 0.5 times: no pixel of the word more than 6 levels off the paper (the halo's measure), each cut k times its width within 4 px, the ink and the eraser k times as wide; enlarged over a marker line outside the group, the floor is scoped, the page is never lighter than it was, and the word adds nothing over the line; widths clamped to 0.1 and 12 mm, markers untouched, and a page of scaled strokes reads back with the same parameters. With the scaling taken out it fails 19 checks: 23, 307 and 921 pixels of the word at 1.1, 1.5 and 2 times, the white ink's cut 8 px where 48 and 64 are right, the eraser's cut 20 px where 10 is right at half size.
  • z_lasso_28_resize_erased (new): a word erased by the precise eraser, a marker line cut by it and a line cut by white fountain pen, with a line the lasso leaves out. 1.1 times (halo 3, no dark pixel at the word or either gap, with the selection and after Done), 1.5 times (the same, the floor scoped over the line left out, which still shows), smaller again to 1.2 times over that scoped floor, and half size (the marker line beside its cut still shows); each undone with page_sig_same 1. On e018fc6 it fails 11 checks: the halo 4 for 3 three times; about 230, 10, 1,460, 121, 640 and 135 dark pixels at erased places; 0 for the ink beside the cut, both sides.
  • z_lasso_29_erased_only (new): a lasso round a word the precise eraser took away and round one white ink covers (nothing selected, "Nothing to select.", no box drawn), round empty paper (as before), round a word that shows and an erased one (both selected, Delete takes both, Undo), round the erased word in exact area, and the mode button judging a lasso again into only the erased word. With plan_shows answering true it fails 13 checks (selected 1 for 0 four times, a box of 710 dark pixels round the erased word); on e018fc6 the same 13. With only the mode button's check taken out it fails its last 3.
  • z_lasso_30_erased_link (new): ink erased wholly inside a link's area, lassoed: the link comes and the selection stays. With links no longer keeping the selection it fails 3 checks.
  • z_lasso_23_erased_marks (changed): its lasso round the erased word alone now selects nothing (fails 3 checks with plan_shows answering true); its check that a moved selection's halo is found once at each place moves the erased word with the word above it (halo_found 2, 4 and 4, drag_inked 1), since a selection of only such ink can no longer be made. z_lasso_24_erased_marks_whole (changed): a lasso where the stroke eraser took a word away says "Nothing to select." (as before; it passes on e018fc6 too).
  • Every z_lasso scenario (31), the four z_refresh scenarios, z_bar_0_make and z_map_pen_select pass on the head; the library's 664 unit tests with the sim feature, test_lasso, test_lasso_live and test_sec_invariants pass.

Gate

GRIMOIRE_TEST_PORT=9997 caffeinate -i make -j8 check on this head (3d9a1b9) passed: make's own last line is "CHECK PASSED" (exit 0), the line before it "RUST CHECK PASSED"; 538 scenario runs (the 8 late ones among them) and 209 language runs, none failed. The Kindle binary is 11,432,208 bytes (guard 13,000,000; 11,429,136 at #203's head) and Grimoire.zip 5,962,635 bytes (guard 7,000,000).

For the owner

  1. Black ink in a resized selection now changes width with it (the issue's decision, "white ink should do the same as black", read with the erasing growing with the ink: all three scale alike). Keeping black ink's width and scaling only erase strokes would be a one-line change, but white ink would then be drawn thicker than the black ink around it, and a shrink would have to choose between erasing that eats ink that showed (widths kept) and traces of erased ink (erasing scaled, ink not).
  2. Erasing stops growing at 12 mm (above). Device check 8 in TESTING.md asks how a twice-as-large resize of a word erased with the 12 mm eraser looks.

Closes #204
Closes #205

🤖 Generated with Claude Code

https://claude.ai/code/session_01Uoe9ZJNyEZYoc4bsjqbSyQ

ganten1998 and others added 3 commits November 20, 2026 04:12
…te ink and erasing alike (#204)

A resize by a corner handle put the group down with its points scaled and every width kept in mm, ink, white
ink and the erasing that goes with the ink alike. Made larger, the erasing no longer covered all the ink it
had erased: a word erased in three passes and the page made 1.1 times as large showed faint traces of it
after Done (the halo outlined them: editor.halo 4 instead of 3, about 230 dark pixels with the selection up,
10 after Done), at 1.5 times dark ones (about 1,460), and a line cut by close strokes of white ink showed
through between them (121 to 142). Made smaller, the erasing took away ink that showed: a line's cut kept its width while
the line shrank, so at half size the ink beside the cut was gone.

lasso.rs lasso_scale_widths scales size_min_mm and size_max_mm of every stroke of the group by the resize's
factor, black ink, white ink and erasing alike, so the group is put down as a picture of itself, larger or
smaller, both ways: what its erasing hid stays hidden and what showed still shows, and a resize undone by
the opposite one gives the widths back. A width stays within 0.1 to 12 mm, the range page_read clamps a page
file's widths to and the brush draws, so the stroke reads back as it was put down; erasing that would be
wider than 12 mm is drawn 12 mm wide (an 8 mm eraser past 1.5 times). Floor markers are left as they are.
sel_place calls it for a resize (a move's spot has scale 1); a paste scaled to fit keeps the widths in mm,
as scale_page does. Undo is unchanged (the step keeps the removed and the added strokes whole), and a floor
is still decided plain or scoped from the strokes as they are put down, now with their scaled widths.

Tests: test_lasso a_resize_scales_widths_with_the_group (a word erased by two passes, a line cut by the
eraser, a line cut by white ink, at 1.1, 1.5, 2 and 0.5 times: nothing of the word more than 6 levels off
the paper, each cut as wide as k times its width, the line wider; over ink outside the group the floor is
scoped and that ink never lighter; widths clamped and read back). With the scaling taken out it fails 19
checks: 23, 307 and 921 pixels of the word at 1.1, 1.5 and 2, the white ink's cut 8 px for 48 and 64, the
eraser's 20 px for 10 at half size. The scenario z_lasso_28_resize_erased: 1.1 and 1.5 times, smaller again
over a scoped floor, half size, each undone (page_sig_same); on e018fc6 it fails 11 checks (the halo 4 for
3 three times; about 230, 10, 1,460, 121, 640 and 135 dark pixels at erased places; none of the ink beside
the cut, both sides).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uoe9ZJNyEZYoc4bsjqbSyQ
…ng, as one round empty paper (#205)

The lasso takes every ink stroke inside it, and ink erased wholly (by the precise eraser or white ink) stays in
the page file under its erasing until compaction, so a lasso round only such ink selected it: since #187 it had
no halo, and the selection showed a box round nothing with a bar whose Copy copied nothing.

select.rs plan_shows tells whether the page shows any of the ink a lasso takes (its strokes taken whole and its
pieces inside an exact-area lasso) by the halo's own rule, one function for both (shown_of: the page as drawn,
stroke_shown_runs, else the estimate): would the selection have a halo anywhere. What the preview found and
kept for the page as it is is read first, the rest found, the first stroke that shows ending it. When none
shows and no link comes with it, lasso_done selects nothing and says "Nothing to select.", the toast of a
lasso round empty paper; the mode button does the same when the lasso judged again in the other mode takes
only such ink (the selection goes, Select mode stays). Beside ink that shows, erased ink is selected as before,
so Copy, Cut and Delete behave as they did. A lasso that takes a link keeps it, with the erased ink: the link
shows (its area drawn dashed), and the link rules (a link goes with every ink stroke inside its area) are
unchanged. No new strings.

Tests: z_lasso_29_erased_only, a lasso round a word the precise eraser took away and round one white ink
covers (Nothing to select, nothing selected, no box drawn), round empty paper (as before), round a word that
shows and an erased one (both selected, Delete takes both), round the erased word in exact area, and the mode
button judging again into only the erased word. z_lasso_30_erased_link: such ink inside a link's area brings
the link and is selected with it. z_lasso_23's lasso round the erased word alone now selects nothing, and its
check that a moved selection's halo is found once at each place moves the erased word with the word above it
(halo_found 2, 4 and 4; a selection of only such ink can no longer be made); z_lasso_24 lassoes where the
stroke eraser took a word away (nothing left: as before). With plan_shows answering true, z_lasso_29 fails 13
checks (selected 1 for 0 four times, a box of 710 dark pixels round the erased word) and z_lasso_23 3; on
e018fc6 z_lasso_29 fails the same 13. With only the mode button's check taken out, z_lasso_29 fails its last
3; with links no longer keeping the selection, z_lasso_30 fails 3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uoe9ZJNyEZYoc4bsjqbSyQ
…ound erased ink, and the device checks (#204, #205)

LASSO-DESIGN.md: row 10 of the matrix (a selection made larger or smaller by a corner: scaled as a picture of
itself, widths and all, ink, white ink and erasing alike; what it did before; the 12 mm a width stays within,
past which erasing stops growing; scoped over ink outside the selection; a paste scaled to fit keeps the widths
in mm), 6.4 (where lasso_scale_widths comes in, and that floors are decided on the scaled strokes), and 6.2 (a
lasso round only ink the page shows nothing of, with no link, says "Nothing to select."; "shows" is the halo's
rule; beside ink that shows such ink is selected as before; a link keeps the selection; the mode button the
same). TESTING.md: the device checks for both, 14 steps. CHANGELOG: folded into #187's lasso line. lasso.rs:
the comment names page_parse, the reader that clamps a page file's widths (the commit before said page_read).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uoe9ZJNyEZYoc4bsjqbSyQ
@ganten1998 ganten1998 added the claude Claude is working on this (assigned to ganten1998, whose account Claude uses) label Nov 20, 2026
@ganten1998 ganten1998 self-assigned this Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude Claude is working on this (assigned to ganten1998, whose account Claude uses)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lasso: a lasso round only erased ink selects nothing Lasso: a selection made larger leaves faint traces of the ink it had erased

1 participant