Repository navigation
Conversation
…t line's last character (#99) The Session gave the mirror the Field's caret as its first cursor as it was. The engine does not clip an empty selection given from outside, so at a line's end the Cursor sat one past the last character: the block drawn past the text, no selection at all on a textarea or a Single-line Field, and the first `l` moving it left. The constructor now clips a caret with `clipToLine`, the rule a caret the person moves later already goes through. A selection held at Activation is given as before (out of scope). Coverage (CODING_STANDARDS rule 5): Normal, the Start Mode, the only Mode a Session is made in. Placements: a textarea (the text's end and an inner line's end), a Single-line Field, a plain contenteditable, a contenteditable in an open shadow root, a block of the Notion shape (one line; three lines at the text's end and at the first line's end), and a Field Activated by focus on a Site whose policy is "normal". Red on main: `npm run red-on-main -- tests/e2e/activation-line-end.spec.ts tests/unit/session.test.ts`. The empty-line test and the held-selection unit test pass there by design: they guard what stays as it was. `caretCharBox` and `near` move from drawn-cursor.spec.ts to extension.ts, shared by the new spec. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
# Conflicts: # src/bridge/Session.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #99.
Summary
The Field's caret at Activation is the mirror's first cursor. The engine does not clip an empty selection given from outside, so at a line's end the Cursor sat one past the last character.
Session's constructor now clips a caret withclipToLine, the rule a caret the person moves later already goes through.Both ways a Session is made (the Activation key, focus on a Site whose policy is "normal") go through this constructor. A selection held at Activation is given as before (out of the brief's scope; a unit test pins it).
Coverage (CODING_STANDARDS rule 5): Normal, the only Mode a Session is made in; a textarea, a Single-line Field, a plain contenteditable, a contenteditable in an open shadow root, a block of the Notion shape.
Evidence
Before:
npm run red-on-main -- tests/e2e/activation-line-end.spec.ts tests/unit/session.test.tsonmain's source: the unit test reads the textarea's selection as[59, 59], expected[58, 59]; 15 of the 16 e2e tests then in the spec fail (the empty-line test passes there by design: that behaviour stays as it was). The shadow-root case and the held-selection unit test were added after that run.After:
tests/e2e/activation-line-end.spec.ts18 passed. Per Field kind:npm run check: 289 e2e passed, 0 failed, 0 flaky.npm run test:e2e:editors: 295 passed, 0 failed, 0 flaky.Merge Danger
Door: two-way
One expression in
Session's constructor; reverting it restores the old cursor.Blast Radius: Activation
Every Activation with a caret goes through the clip. A caret anywhere but a non-empty line's end is unchanged. The clip splits lines on
\nonly while the mirror also splits on\r; a textarea never holds one, not checked for a contenteditable projection.🤖 Generated with Claude Code