Repository navigation
Leave the words after a removed line where the field's foot holds them - #6476
Merged
Merged
Conversation
Deleting a line in the floating panel's field or a card's reply field, with lines after the caret, drew those lines a line higher for a frame and then glided them back down, in Chromium and Firefox at full speed. box-motion.js carried all of an editor's words by its start edge: right for the words before the removed line, which ride the box's top edge down, and wrong for the words after it, which layout leaves where the box's foot holds them. Carrying them by the edge that stayed instead, as a rule of 25 October did, made the words before jump; #4326 put the start edge back. Neither single edge suits both sides of the line. The editor now marks the line the last change ended in (`data-lf-edited`), and while a key's removal travels, box-motion draws the words after that line farther by the height the field gave up (`--lf-field-after`), so they ride the end edge while the words before ride the start edge. Where the end edge rose, as in the comment box beside its passage, the words after stand where layout puts them, as before, rather than be drawn below the field's box, which clips them; holding that box's overflow open for them laid a one-line field's caret out below its box and wrote scrolls that moved nothing. The Send corner's reading takes each line's own carry back off. `test_a_line_removed_among_the_words_moves_only_what_layout_moved` removes a line with two after it in each floating box, in both engines, checks that every part moves one way, and, on the panel and the card, holds the removal's first frame to check that no word jumps. On main the panel and the card fail it in both engines, their words after the line turning back; held at the first frame, those words stand a line away (about 1,550 pixels change, against under 300). The comment box passes on main and with this change. With it, all six pass.
…nd edge Backspace at the start of a line, under a blank one, left that line riding the start edge: the mark went on the line the change ended in, which there is the merged line itself. The editor now marks the first line whose words all come after the change (`data-lf-after`): that line where the change ended at its start, and otherwise the line below. The words after a change now ride the field's end edge, so their extra carry is the end edge's travel less the start's, kept from going below a rising foot. Measured as the height the box lost, it fell short by the scroll a field gave up when the removal let it stop scrolling, and drew the words after the line that much higher for a frame. A line drawn off its place ran past the editor's own box, which in a text field doesn't scroll, and the editor's reveal wrote a scroll there that moved nothing. The reveal now gives the editor's own box a share of the caret's travel only where it is a scroll container. The test takes a line away three ways (Backspace at a line's end, at the next line's start, and in the panel's field at its cap scrolled to its end) and reads each removal's first frame with the motion held. With the line-start mark reverted, the panel and the card fail in both engines; with the old measure, the panel's capped case does.
A key that adds words takes no tween (box-motion.js: the user asked for typing to grow the box as a textarea's grows), so the words after a line Shift+Enter adds stand while the rest take their places in one frame. The test now records each Shift+Enter too, with two lines after the caret, in every box and both engines. Letting a typing change that grows the box tween fails it in the panel and the card, both engines: the words after the new line are drawn a line low and glide back. The Shift+Enter that takes the panel's field to its cap stays unchecked: the field draws the words after the line a frame before its scroll takes them back up by what overflows, on main as well.
max-sixty
marked this pull request as ready for review
November 19, 2026 07:16
This was referenced Nov 19, 2026
max-sixty
pushed a commit
that referenced
this pull request
Nov 19, 2026
Clearing a panel or comment field marked its only line as "after the change", and that is what broke `test_an_explicit_target_does_not_overwrite_its_existing_draft` on `main`. #6476 added the mark (`data-lf-after`, `afterChange` in `field-editor.js`) so a removal's carry can split between the words before a removed line and the words after it. A change that ended at the field's end still marked a line when that end fell at a line start. When the field switches drafts, it clears and refills in a single task, so the mark landed on the line and came off again. The write watch then failed the test at teardown with `unchanged write: data-lf-after on div.cm-line.lf-face-p … leaf-text.lf-ui.lf-response-control.lf-fab-input` ([run 44480242315](https://github.com/max-sixty/leaf/actions/runs/44480242315)). No words follow a change that ends at the field's end, so the field now marks no line there. Every other placement of the mark stays as #6476 left it. Evidence, run locally: - `test_an_explicit_target_does_not_overwrite_its_existing_draft` passes on #6476's parent, errors at #6476 (`626ddc467`) and on `main`, and passes with this change. - #6476's own `test_a_line_removed_among_the_words_moves_only_what_layout_moved` passes in all six cases (panel, card and comment box, in Chromium and Firefox). The rest of `test_comment_targets.py` and `pnpm run test:runtime` pass too. Refs #6418 — automated triage Co-authored-by: leaf-agent <[email protected]>
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.
Deleting a line in the floating panel's field or a margin card's reply field, with lines after the caret, drew those lines a line higher for a frame and then glided them back down, at full speed in Chromium and Firefox.
box-motion.jscarried all of an editor's words by the field's start edge. That suits the words before the removed line, which ride the box's top edge down, but not the words after it, which layout leaves where the box's foot holds them.Now the editor marks the first line whose words all come after the change (
data-lf-after, a CodeMirror line decoration infield-editor.js). While a key's removal travels, box-motion draws that line and those below it by the field's end edge rather than its start (--lf-field-after). The words before the line ride the top edge as #4326 made them, and the words after it stand.Firefox at half speed: two rounds of Shift+Enter then Backspace, with the caret at the end of the second line. Each frame grid is eight consecutive frames around one Backspace, read down the left column and then the right. Chromium moves the same way; the test below reads the same positions in both engines. Playwright's Firefox video now and then drops the whole panel for a frame, in both arms, so the grids show a Backspace without such a frame.
What to weigh
git log -Lon the carry shows the edge flipping: Move the margin card onto box-motion, the floating boxes' one motion #4174 carried a shrinking field's words by the edge that stayed, which made the words before a removed line jump, and Move a panel field's words and marks with the box's edge #4326 went back to the start edge, which turns the words after it back. Splitting the carry at the change replaces the single edge rather than adding a case beside it.#cornerTaken) takes each line's own carry back off, so it reads the words where layout puts them. The editor's reveal (editor-view.js) now gives the editor's own box a share of the caret's travel only where that box is a scroll container. A text field's isn't, and a line drawn below it made the reveal write a scroll there that moved nothing.box-motion.js; the user asked for typing to grow the box as a textarea's grows), so a line Shift+Enter adds among the words leaves the words after it standing while the rest take their places in one frame. The split carry is a removal's alone, and measured growth needs none.Not in this change: Shift+Enter that takes a field to its cap turns the words after the new line back by the overflow (2 px in the panel, 17 to 18 px in the card and the comment box at 1440×900). The field draws them a frame before its scroll takes them back up, so it isn't the carry. Main does the same, in all three boxes.
Evidence
test_a_line_removed_among_the_words_moves_only_what_layout_moved(new, beside the property test) adds and takes away a line with two lines after it, three ways in each floating box, in both engines: Backspace at the end of a line, at the start of the next one, and, in the panel, in a field at its cap scrolled to its end. It records the Shift+Enter that adds the line as well as the Backspace (all but the one that takes the panel's field to its cap, above). It checks that every part moves one way, and, holding each removal's first frame, that no word in the panel or the card jumps. On main the panel and the card fail in both engines. Reverting only the line-start mark fails them again, restoring the old measure of the extra carry fails the panel's capped case, and letting a typing change that grows the box tween fails the panel and the card on the Shift+Enter, their words after the new line drawn a line low and gliding back.test_lines_removed_below_the_field_s_cap_leave_the_rest_in_place,test_a_line_the_field_gives_up_rides_the_box_s_top_edge, the card-reply growth tests, the editor reveal tests (file-editor page navigation, a long rewrite's caret, a new line past the field's height),pnpm run test:runtimeandpnpm run check.Found while settling why #6450's floating-box test failed on Linux. An independent review pass found the line-start and capped-field cases, both fixed here.