fix(html): stray line numbers, and two refusals that described the old editor - #879
Merged
Conversation
…d editor Both found by using the thing. Deleting across several lines of a `.txt` left a line number behind per line. `removeText` took `textNr.lastChild` away, and the renderer writes whitespace between the number cells - so what went was a text node, not a cell. `lastElementChild` is what reaches one, which the comment above `getPosition` already said about the lines and nobody carried across to the gutter. Nine lines deleted down to seven left eight numbers; a check now drives that. And two refusal messages still described the editor as it was before it could span runs. Code 1 said "new line not supported by this document" though Enter has been taken since then, and code 8 said "an edit has to lie inside one run of text" though it now marks a range reaching over a picture or a table - which reads as though editing across runs does not work, when it does. The codes are untouched; only what they say changed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KKFKbUVCYF2VhujdmjhhPW
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.
🤖 Generated with Claude Code
Two things found by opening the wasm example and using it.
Stray line numbers in a
.txtDeleting across several lines left one line number behind per line — 9 lines
deleted down to 7 left 8 numbers.
removeTextdidtextNr.removeChild(textNr.lastChild). The renderer writesthe gutter formatted, so there is a whitespace text node after the last cell:
lastChildwas that whitespace, and the cell survived.lastElementChildiswhat reaches a cell.
The comment above
getPositionalready warns about exactly this for the lines— "formatted output puts a whitespace text node between them, and counting or
indexing those as lines is off by as much as a factor of two" — and nobody
carried it across to the gutter, which is written the same way. It now says so.
A check on the page drives a three-line delete and asserts the two counts move
together, and that undo brings both back.
Two refusals describing the editor as it was
taken since feat(html): a text editor that owns the edit #875; the code now marks only a soft line break.
before feat(html): a text editor that owns the edit #875 and reads as though editing across runs does not work — which is
exactly how it was reported to me. It now marks a range reaching over a
picture or a table.
Codes are untouched, so nothing a host maps changes. The refusal table in
editing.mdnow also says why a range over a picture is refused:replaceRangetakes runs and whole paragraphs away, so anything else caughtbetween the ends would survive while the text around it went.
Reference output
resources/editing.jsandresources/text.jschange, so this needs a pinadvance once it lands.