R4.5: a press lands on the pressed character [~]

Component 5af11fe..c35fdac (pushed): a press opens its block with the
caret on the pressed character; a secondary press moves the caret and
emits DocumentEvent::Pointed. Three review rounds failed; the round-3
findings are fixed with the reviewer's probes as regressions, unreviewed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-14 11:35:38 -04:00
1 parent 293643b8ae
commit 07c0b43542
4 files changed
+41 -1

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
FAIL
1. Ely-GPUI-Components/src/documents/tree/sources.rs:105 — Continued blockquotes do not map back through their quote prefixes. With `> alpha\n> beta`, a right press on the rendered `e` of `beta` moves to byte 2 (`a` in `alpha`), instead of byte 11. `align` skips the newline but cannot cross the following `>`, then silently uses the leaf start. Preserve the source positions of continuation lines, including their container prefixes. Reproduced by `review_quote_ui_press_maps_continuation` in `.work/R4.5-r1-review/ui-probes.log`.
2. Ely-GPUI-Components/src/documents/tree/sources.rs:97 — Alignment returns before skipping source characters that precede the requested glyph. In `a \*star\* z`, the displayed first `*` maps to byte 2 (the backslash), not byte 3. In ``a ` xy ` z``, the displayed `x` maps to byte 3 (the stripped space), not byte 4. Normalize the source position before returning the requested character; cover the escaped glyph and first character of a trimmed code span, rather than only characters after them. Both exact-offset probes fail in `ui-probes.log`.
3. Ely-GPUI-Components/src/documents/tree/sources.rs:31 — `code_from` only handles code whose complete displayed body follows the first newline verbatim. Ordinary indented code therefore has no character mapping. For ` alpha\n beta\n`, pressing the rendered `e` of `beta` should land at byte 15; the actual left press opens at byte 18 and the right press reports byte 0. Track code positions through removed indentation instead of dropping to `Place::Block`. Both mouse-path probes fail; equivalent fenced-code controls pass.
4. Ely-GPUI-Components/src/documents/tree/mod.rs:418 — The new source metadata trusts positions on alert text that `tree/blocks.rs::marker` has already shortened without updating its position. For `> [!NOTE]\n> alpha beta`, a right press on `b` reports byte 2, inside `[!NOTE]`, instead of byte 18. Preserve or adjust source positions when removing the alert marker before recording `Inline.sources`. Both the mapping probe and `review_alert_ui_press_maps_body` reproduce this.
5. Ely-GPUI-Components/src/documents/tree/mod.rs:366 — HTML blocks are drawn through `html_block_text`, which never populates `Inline.sources`; their new text-press handler consequently has no source location. For `<div>alpha beta</div>\n`, pressing the rendered `e` should land at byte 12, but the left press opens at byte 21 and the right press reports byte 0. Carry source spans through HTML text extraction and normalization. Both real mouse-press probes fail in `ui-probes.log`.
6. Ely-GPUI-Components/src/documents/document/visual.rs:116; src/documents/render.rs:413 — Raw link definitions and front matter bypass character hit testing entirely. Right-pressing byte 10 of the displayed `[ref]: https://ely.dev` reports byte 0. Pressing `v` in the displayed front matter `---\ntitle: value\n---\n` should land at byte 11, but reports byte 0 on right press and opens at byte 20 on left press. Route these literal text renderings through `TextLayout` hit testing with their source offsets, including the removed front-matter fence. The definition and front-matter probes reproduce the failures.
7. Ely-GPUI-Components/src/documents/document/point.rs:124 — Focusing the document after a secondary press triggers `focused`, which automatically opens an empty visual document. A right press in an initially closed empty document emits `Pointed` and then creates and focuses a `TextInput`, violating the explicit requirement that a right press open no block. Keep secondary pointing from triggering this auto-open path. `review_empty_closed_document_right_press_stays_closed` verifies that the document starts closed and fails after the actual right press.
8. Ely-GPUI-Components/src/documents/document/point.rs:106 — Target kind and context are captured before committing the open block and are not reconciled with the reparsed document. Open the first paragraph of `First.\n\nalpha beta\n`, replace it with an opening code fence, then right-press the rendered `e` in the second paragraph. The caret correctly moves to byte 12 of the resulting code block, but the event says `Paragraph` and `in_code: false`, giving the owner the wrong menu context. Resolve the surviving target against the committed parse, or reject a target invalidated by that edit. `review_right_press_uses_kind_after_commit` reproduces the mismatch.
9. Ely-GPUI-Components/src/documents/tree/sources.rs:73 — The added comment “Source byte under drawn byte `at`, if a piece holds it.” contains 11 words, exceeding the project's explicit ten-word limit. Shorten it to at most ten words; the added-comment scan records this in `.work/R4.5-r1-review/checks.log`.
+10
View File
@@ -0,0 +1,10 @@
FAIL
1. Ely-GPUI-Components/src/documents/tree/blocks.rs:140 — A decoded newline can panic while opening valid Markdown. `marker` calls `past_line` before checking whether the quote is an alert, and `past_line` assumes the decoded newline exists literally in the source. Parsing `> alpha&#10;beta` without a final newline panics with `its line end is written`; `> [!NOTE]&#10;alpha beta` also panics. Derive the retained text's position through the decoded-to-source mapping, and only adjust a confirmed alert; do not assert that decoded breaks must be physical line endings. Reproduced by both `review_r2_*_with_encoded_newline_does_not_panic` probes in `.work/R4.5-r2-review/point-final.log`.
2. Ely-GPUI-Components/src/documents/tree/sources.rs:55 — CRLF lines fail character mapping because `written` loses its trailing CR while `shown` retains it. The failed suffix comparison makes `on_point` use the body's initial offset. In a bare fenced code block with CRLF and body `alpha` followed by `beta`, pressing `p` returns byte 5 instead of 7, with both mouse buttons. Multiline CRLF front matter returns 5 instead of 12 for `v` in `title: value`; a multiline link definition returns 0 instead of 10. The new helpers also ignore CR-only line endings: the code body starts at the closing fence's end. Read LF, CRLF and CR consistently on both sides while retaining original byte offsets. The CRLF mouse probes and `review_r2_line_mapping_matrix` fail in `.work/R4.5-r2-review/point-final.log`; the existing regression only exercises the final CRLF code line.
3. Ely-GPUI-Components/src/documents/tree/sources.rs:143 — Greedy equality still mistakes removed syntax for the pressed glyph. Right-pressing the displayed backslash in `a \\ z` reports byte 2, the escape, instead of byte 3. In `> <div>\n> >alpha beta</div>`, pressing the displayed `>` reports byte 8, the quote prefix, instead of byte 10. The same ambiguity maps the retained leading space in the code span of ``a ` xy ` z`` to trimmed byte 3 instead of byte 4. Preserve which bytes are escapes, container prefixes and trimmed code delimiters before matching retained characters. The backslash and quoted-HTML mouse probes, plus `review_r2_code_normalized_space_reads_back`, reproduce these remaining round-1 alignment cases in `.work/R4.5-r2-review/point-final.log`.
4. Ely-GPUI-Components/src/documents/document/point.rs:132 — Comparing only the pressed block's raw text does not detect changed reference targets, so a write-back can still emit stale context. Open `[ref]: https://old.dev\n\nGo [there][ref]\n`, edit the first block's definition to `https://new.dev`, then right-press `there`. The definition is committed and the paragraph resolves to the new address, but `Pointed.link` is still `https://old.dev` because the paragraph's source text is unchanged. Resolve the target from the committed parse, or reject the press when its resolved metadata changes as well as when its source changes. `review_r2_changed_definition_does_not_emit_old_link` fails with the old address in `.work/R4.5-r2-review/point-final.log`.
+11
View File
@@ -0,0 +1,11 @@
FAIL
1. Ely-GPUI-Components/src/documents/tree/sources.rs:287 — The join branch consumes retained indentation and literal `>` characters as removed container prefixes. In ``a `fox\n y` z``, pressing the displayed `o` moves to byte 3 (`f`) instead of byte 4, with either mouse button. In `> <div>\n> > alpha beta</div>`, right-pressing the displayed `>` returns byte 7 instead of 10. Preserve which prefixes were actually removed and which spaces or marks remain displayed; do not consume every leading `[ \t>]` as one join. Reproduced by `review_r3_inline_code_kept_indent_press`, its left-press counterpart, and `review_r3_quoted_html_kept_mark_press` in `.work/R4.5-r3-review/press-final.log`.
2. Ely-GPUI-Components/src/documents/tree/sources.rs:31 — Assigning Markdown decoding to every text leaf incorrectly decodes literal character references inside autolinks. For `<https://example.com/?a=&amp;b=2>`, the renderer keeps `&amp;` verbatim, but the reverse reader decodes it and abandons matching the preceding text. Right-pressing `x` in `example` consequently returns byte 1 instead of 10. Carry the autolink's verbatim context into its source pieces so their decoding matches the parsed text. `review_r3_autolink_literal_reference_press` fails on this commit and passes on `83d747d` (`press-final.log`, `base-comparison.log` in `.work/R4.5-r3-review/`).
3. Ely-GPUI-Components/src/documents/tree/sources.rs:32 — Code spans are always read as plain source, missing GFM's removal of escaped pipes inside table cells. In ``| `ab\|cd` |\n| --- |\n| cell |\n``, the cell displays `ab|cd`, but the remaining source backslash stops reverse matching. Right-pressing `b` reports byte 3 instead of 4. Preserve the table context and map its escaped pipes through their removal without decoding ordinary code-span backslashes. `review_r3_table_escaped_pipe_press` fails here and passes on `83d747d` (`press-final.log`, `base-comparison.log`).
4. Ely-GPUI-Components/src/documents/tree/sources.rs:309 — Decoded whitespace cannot participate in the whitespace normalization applied by the renderer: both the join handling and the skip branch require raw source characters. Right-pressing `b` in `ab &#10; y` returns byte 0 instead of 1; right-pressing `b` in `<div>ab&#32;</div>` returns byte 5 instead of 6 because the decoded trailing space was dropped from the drawing. Apply the same Markdown line joining and HTML whitespace collapsing to decoded references while retaining their source offsets. Both mouse probes (`review_r3_decoded_line_end_press`, `review_r3_html_decoded_space_press`) fail here and pass on `83d747d` (`press-final.log`, `base-comparison.log`).
5. Ely-GPUI-Components/src/documents/tree/sources.rs:263 — The new numeric-reference decoder differs from markdown-rs: it accepts C0/C1 controls that the parser replaces with U+FFFD. For `ab &#128; y`, reverse matching therefore encounters a different character from the drawing and incorrectly maps a right press on `b` to byte 0 instead of 1. Decode numeric references with the parser's rules, including its control-character replacements. `review_r3_numeric_control_press` fails here and passes on `83d747d` (`press-final.log`, `base-comparison.log`).