Repository navigation
Hang a code line's wrapped rows from its indent behind a muted ↪ - #6654
Conversation
…side it reads no siblings
…ize, and box Leaf's diagnostic text
# Conflicts: # tests/browser/projection/test_revision_patches.py
leaf-agent
left a comment
There was a problem hiding this comment.
Several tests the diff doesn't touch take a code block's text as one text node (code.firstChild.data). Now that boxLines moves that text into [data-lf-pre-line] spans, firstChild is a span, and these helpers throw before they make any assertion:
tests/browser/test_render_send_placement.py::test_a_quoted_passage_keeps_its_inline_attachment_before_and_after_send, thephrasehelper (document.querySelector('#source code').firstChild). It passes on the base and fails here withCannot read properties of undefined (reading 'indexOf'). With the helper changed to find the text node that holds the words, it passes on this head, so the product behaviour holds.tests/journeys/test_render_anchors.py::test_code_copy_keeps_source_and_stays_beside_scrolling_and_revised_blocks,suffix_uncovered(pre.querySelector('code').firstChild). It passes on the base and fails here withassert '' == 'VISIBLE_END'. Journeys run only nightly, so this PR's checks won't show it. After the merge, main's next scheduled run would go red. Once that helper reads the last text node, the test fails again later on (String.repeatgets a negative count), so it may read the old shape in more places.tests/browser/margin/test_scrollers.py:PIN_ON_LINEand the helpers intest_a_pin_on_lines_partly_scrolled_away_stands_by_one_still_shownand theshort_secondreading below it all readcode.firstChild.data, and here they throw aTypeError. In this sandbox the pin assertions also fail on the base, with the same offsets I got here after rewriting the helpers to read across text nodes. So I can't tell from here whether pins on code lines still land on their line. CI's run of these tests is the evidence that will settle it.
Some tests also take firstChild of code that no reading-face <pre> holds and that this PR doesn't box, such as tests/browser/drafts/test_draft_editing.py and test_render_gate.py::test_an_identifier_in_a_cell_breaks_rather_than_holding_its_column. Both pass on this head.
Each of these tests protects behaviour that this PR is meant to keep. So the fix is to make each helper read the block's text across its line boxes, for example with a TreeWalker over the text nodes, as the PR's own test_a_code_block_wraps_its_lines_whatever_holds_it now does. Their assertions should stay as they are.
… scrolling listing's lines
…e: pre (#6657) Since #6629, a reading-face `<pre>` wraps its long lines, so a code block scrolls sideways only where its author sets `white-space: pre`. #6629 gave its scrolling-code fixtures that style but missed two in reach tests. Those blocks now wrap, so Leaf lends them no Tab stop, and both tests failed in push run [44879949277](https://github.com/max-sixty/leaf/actions/runs/44879949277) on `8faa6acf1`: - `test_borrowed_scroll_stops_leave_code_selection_and_marks_with_their_owners[-1]`: `#code` kept its authored `tabindex="-1"`. - `test_a_scrolling_box_takes_a_stop_unless_tab_reaches_a_control_in_it`, subtest "scroll surfaces added after upgrade gain keyboard reach": `#late-native` never got `data-lf-more-after`. Both fixtures now set `white-space: pre`, so the tests again check the keyboard reach of a code block that scrolls. Product code is unchanged. Verification: both pass on #6629's parent (`028644a4f`). They fail at #6629 (`eddb052c7`) and on `main` (`7abe4c3d9`), and pass on this branch. The run's 18 `test_scrollers.py` pin failures also began at #6629. #6654 has since repaired them: they pass on `7abe4c3d9`. Refs #6655 — automated triage Co-authored-by: leaf-agent <[email protected]>
…changed (#6660) Four of the failures in scheduled `ci` run [44896279165](https://github.com/max-sixty/leaf/actions/runs/44896279165) on `c72a8ad03` are tests that weren't updated when a recent change moved what they read. None of them catches a defect a user would see, so each fix updates the test and keeps what it asserts. Each test failed locally on `c72a8ad03` and passes with this change. - **`test_the_page_holds_still_under_the_user[dial-*]`** (8 cases, Linux and macOS). #6612 put each depth's reading time under its word, so the dial's radios are now named `Skim 2 min` and so on. `turn()` was still waiting for a radio named exactly `Skim` and timed out after 120 s. It now matches `^Skim \d+ min$`, the same pattern `tests/browser/widgets/test_dial.py` uses. The six cases now pass, and the two `dial-grown-after-glide` cases fail as their `MOVES_ON_MAIN` entry expects. - **`test_a_link_s_preview_shows_only_what_the_page_draws[browser]`** (teardown error, Linux and macOS). #6654 wraps each line of a reading-face `<pre>` in a `<span data-lf-pre-line>`. That means `#code > span` now selects the first line's wrapper rather than the hidden span. The `COPY CONTROL` words the test inserts after it became an extra line, which pushed the rows below down 20 px with no input, and the shift watch reported that. The test now inserts the words after `#code span[style]`, the hidden span it meant, so they stay on the first line. - **`test_every_restore_case_a_user_can_return_to_is_arrived_in`** (Linux and macOS). #6641 adds ` (fails the check so that …)` to each finding. The test split the `returned holding a,b` list on commas only, so the suffix stuck to the last key. Whenever storage listed the restore case's own key last, the parse dropped it. The order of keys in storage is what made this pass locally and fail on CI. The test now reads the list up to the first space. - **`test_arrangement_retains_linked_pages_per_phase`** (`dev-tests`). #6640 stopped Leaf writing `target="_blank"` over cross-origin links. The test's authored links now open in the same tab, so `expect_popup` timed out. The test now follows both links in place and checks the restored addresses and the kept decision as before. Refs #6659 — automated triage. The report's other failures are owned elsewhere: the long-thread card width is #6139, the Firefox `ResizeObserver` loop is #6604, and the macOS-only failures are tracked in their own cause issue. Co-authored-by: leaf-agent <[email protected]>
#6629 wraps a
<pre>'s long lines and hangs every wrapped row two columns from the block's edge. A real line can start in that column too, so a wrapped row could pass for the next line, and in indented code it continued left of its own indent. Max picked, from four drawn options, the treatment LaTeX's fvextra prints by default: each wrapped row starts two columns past its line's own indent, behind a muted ↪.CSS has no selector for the rows a wrap makes, so
dressCodenow first puts each line of a<pre>that wears the reading face in a<span data-lf-pre-line>holding its text through its newline (code-lines.js). The spans change no text, so anchors, selection, the clipboard and Copy read the same characters, and the tokenizer that runs after it cuts its tokens at the lines' edges. A block where an element holds a newline mid-way, where a<br>breaks a line, where its<code>shares it with other text, or whose rows are boxes already (a widget's listing) keeps #6629's hang without the mark: one of 324 distinct blocks on this Mac's Leaf pages. A draft's code lines in the reply box, and Leaf's own diagnostic text (copyable-text.js), take the same hang and mark.What to weigh beyond the diff. A page's CSS for
pre spannow reaches the line spans;page-authoring.mdsays so. A wrapped indented line moves once as a page starts, as lf-code's lines already did. Four fixes ride along: rows now hang withtext-indent: … hanging, which keeps tab stops where they were, so lf-code's tab-indented lines no longer start two columns early; thelinesreading (passages.js) no longer reads a newline twice at a box's edge, which had a link preview of lf-code show each line break twice and half its lines; and the reply-box hint's.lf-compose-placeholder-lead:not(:empty) ~ spannow names the hint's parent, since every span on the page read back over its earlier siblings for it, so a 16,000-line block took 516 ms to lay out in Chromium (53 ms now); the selector-key test now refuses a~rule whose ancestors name no key. And #6629 had made every reading-face<pre>wrap, whichmargin-layout.jsread as prose, so a comment's pin on a code block's line stood beside its words and the block's own pin inside its corner; a block inside a<pre>counts as preformatted again, and the margin tests that caught it (outside the PR job's selection) pass.Tests: a theme test that a wrapped row hangs from its line's indent behind the mark, that tabs count at the block's
tab-size, that a selection survives the boxing, and that the block reads and selects as its source (fails without the pass); a revision test that a rewritten block is boxed again and an untouched one keeps its boxes; tests that read a code block's text as one text node now read it across text nodes (WORDS_RANGE,WORDS_RECTSinrender_harness.py), and the scrolling listing fixture keeps its lines withwhite-space: pre. Focused browser tests,pnpm run test:runtimeandleaf-dev stillsin Firefox pass locally. Reviewed by Codex (its seven findings are fixed here), a fresh look at the captures, and the review bot (its test-helper findings are fixed here).