feat(text): read a text file in a quieter gutter - #682
Merged
Conversation
The text view was the last one still on its first styling: a browser default monospace against a three-pixel grey rule, no page padding, and line numbers that drifted off their lines the further down the file you read - the script sizing the number cells rounded a fractional line height per cell. Restyle it against the palette the xml, filesystem and sheet views already use, pin the line height to a whole pixel, measure the lines with `getBoundingClientRect`, keep the numbers out of a selection of the page, and mark the hovered line across both columns. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SJYhr3t6QBamsHRfZ7gPDw
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
The text view was the last one still on its first styling.
text.csswas fivelines: a browser-default monospace, a three-pixel grey rule for the gutter, and
no padding anywhere, so the file started in the top-left corner of the window.
It now uses the palette and the type the xml, filesystem and sheet views were
moved to — tokens,
ui-monospaceat 13px, a hairline rule, a washed gutter,tabular-numsnumbers.Two things beyond the paint:
text.jssizes each number cell toits line so a wrapped line keeps its number, and it read
offsetHeight, whichis rounded. At a line height of 20.8px every cell was off by .2px and the
columns were seven pixels apart by line 33. The line height is now a whole
pixel and the measurement is
getBoundingClientRect().height, which is notrounded.
user-select:none— selectthe page and you get the text without a column of numbers down the left.
The hovered line is marked across both columns: each line begins a viewport to
the left of itself and pads the text back, so its background reaches under the
number. Overflow to the left of the page does not scroll, so nothing moves.
No markup changed — the reference outputs are byte-identical,
text.cssandtext.jsare not part of them.Verified in Chrome on
txt/open_document_reader_h.txt(code, unwrapped) andtxt/lorem ipsum.txt(prose, wrapped), including that the editor still insertslines and keeps the two columns aligned.