Repository navigation
Hang a file's wrapped rows from their indent - #6770
Merged
Merged
Conversation
…d rows from their indent Two leftovers of the file editor from #6019. A write from elsewhere whose one change rewrote a line and took the next ones away marked the rewritten line and drew no rule for the lines it removed: the gap rule was drawn only for a change that put no changed line in their place. The rule now follows the lines a change marks wherever it left fewer lines than it replaced, the same rule a pure removal draws, below the last line where the gap ends the file. A line can now carry its mark and a gap rule together, so the gap no longer gives way to a mark on the same line. tests/runtime/file-editor-writes.test.mjs gains both cases, which failed before. A long line in the editor wrapped onto rows that started at the editor's edge, so on a phone a wrapped row of indented YAML read as a new top-level key. Each row after a line's first now hangs two columns past the line's indent, behind the mark a code block's wrapped rows wear, as the reading face's code blocks and a draft's code lines already do. The editor states each visible line's indent through a line decoration, counted with CodeMirror's own countColumn, which the core bundle now exports. test_file_editor_long_filename_keeps_the_phone_editable now also checks that every wrapped row of an indented line starts past the line's first word; before, they started at the edge.
…watch CodeMirror's Tile.sync assigns a line's style.cssText whenever any of its attributes change, without comparing it, as the active line's class and a written mark change it. The file editor's lines now state their indent in their style, so test_file_editor_takes_in_an_outside_write_to_other_lines reported those restatements as unchanged writes.
leaf-agent
reviewed
Nov 22, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
The editor theme restates the code block's wrap hang instead of sharing it; see the inline note.
The rule for a rewrite that also took lines away judged each change of the character diff on its own, so a rewrapped paragraph, whose changes join one line to the next and split another, drew a gap rule between lines it only rewrote: "aaa\nbbb ccc" written as "aaa bbb\nccc" marked both lines and a gap. Two changes meeting inside a line neither changed also read each other's lines. The marks now come from jsdiff's diff of the two versions' lines: each line put in is marked, and a run of changes that took away more lines than it put in draws the gap after the lines it put in. That deletes the per-change reading of lines, its trimming of the lines a change's ends share, and the "wo\nt" reasoning behind it. A line with a gap above and below now shows both rules; the per-line map kept one. file-editor-writes.test.mjs gains the rewrap, which the previous commit marked with a gap, and lines taken from both sides of a line, which main marked with one rule. The hang now counts only spaces and tabs as indent, as a code block does.
…adopts The hang of a wrapped code line, its formula, its hanging text-indent and the masked ↪ before its rows, stood in reading.css for a code block's boxed lines, in the composer's sheet for a draft's code lines, and, since the last commits, in the file editor's theme. It now stands once in marks.css, keyed on `data-lf-pre-line`: the document and every declared shadow stage already adopt that sheet, and the composer's root now adopts it too. Each owner marks its lines and states only what differs, the padding its mark stands past (`--lf-pre-line-inset`): the composer its code box's inset, the file editor its line padding, a code block's line none. The rule sits in lf-base, so a page's own rules still outrank it, as they outranked the reading face's copy. lf-code keeps its own hang (code.css): its lines' `::before` is the line number, so the shared mark would draw over its gutter. Checked: test_a_wrapped_row_hangs_from_its_line_s_indent_behind_a_mark (code block hang 6ch, mark at 4ch), the phone file editor test, and Firefox captures of a draft's wrapped code line and the editor's, each pixel-identical to before.
# Conflicts: # browser/vendor/codemirror.esm.js
The maintainer chose on 23 November to leave the marks as they are on main: a write that rewrites a line and removes the next ones tints the rewritten line and draws no rule, as VS Code and JetBrains do. The rule under the rewritten line joined its bar into a box. This takes the line-diff marking, the jsdiff import and the combined gap rule back out, and with them the three cases that expected a rule beside a rewritten line or two rules on one line. Kept as a test: a rewrapped paragraph marks its lines and no gap, which main's marking already does.
max-sixty
marked this pull request as ready for review
November 23, 2026 20:04
leaf-agent
approved these changes
Nov 23, 2026
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.
Fixes a file editor leftover from #6019: on a phone, a wrapped YAML row started at the editor's edge, like a new key.
Wrapped rows hang from their line's indent. Rows now start two columns past the indent, behind the ↪ mark code blocks use. That hang now has one rule, in
marks.css, which the document, every shadow stage and now the composer adopt; code blocks, drafts and the editor mark their linesdata-lf-pre-lineand state only their padding.lf-codekeeps its own, since its::beforeis the line number.The editor takes the look code blocks and the reply box already have, so a file wraps the same way in each. Max left the pick to me. The alternative was rows at the indent with no mark, as VS Code does: it would give the editor a look of its own, and at phone width a wrapped row then reads as a value under its key.
To weigh: the core bundle exports CodeMirror's
countColumn; the write watch allows CodeMirror's restated linestyle.Left out: the marks for a write that rewrites a line and removes the next ones stay as on
main, on Max's pick; YAML number and boolean colours merged as #6776; a plain link to a pane no longer moves the page onmain.Tests: a phone check of where wrapped rows start, and one runtime case for a rewrapped paragraph's marks;
pnpm run test:runtime.