~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/knotless

git that lives in your Atmosphere account

knotless.dev
1 collaborator

knotless 0.13.0 Latest 2 packages, 1 image

1
10

A line's number marks the whole line in place, and shift marks a range

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/knotless:web/line-marks

What changes

A line marks in place. Clicking a line number on a file or its blame changes the URL's hash without scrolling. Before, the browser jumped that line to the top of the page. The click replaces the history entry, so moving between lines doesn't fill up back.

The whole row is marked. A band behind the row covers the number, the blame column and the code, out to the box's edge. It replaces the target CSS highlight, which covered only the line's text. target() in highlight.ts and its ::highlight(target) rule are gone.

Shift marks a range. Clicking one number and then shift-clicking another marks the lines between, as #L5-L10, in either direction. A link to a line or a range opens with its first line in the middle of the page. Cmd, ctrl and alt clicks still go to the browser.

Why

When you click a line to share it, you expect the page to stay where it is. Only the text was tinted, so blank lines showed no mark at all. Ranges are how you point at a block of code.

How it was checked

svelte-check. With just look: file --click '#L3' (the row is marked and the page stays put), /alice.test/tally/blob/main/src/lib.rs#L5-L10 on desktop light and phone dark, and blame --click '#L4' (the band crosses the blame column). The recorded pages have no hash, so no shot moves.

Shortcomings

The shift-click anchor is the range's first line, not the line clicked first. So after you extend a range upward, the next shift-click extends from the new top.

🤖 Generated with Claude Code

Approved

This replaces the text-only target highlight with a band across the whole row. Clicking a line number now sets the hash in place, without scrolling or adding history. Shift-click marks a range, and a #L5-L10 link opens centered on its first line. I found nothing that must change.

The goto options replace: true, reset: false don't look like the SvelteKit options I know (replaceState, noScroll). The repo is on Kit 3, which I can't check from here, and your note says svelte-check passed. Please confirm the click really stays in place and replaces the history entry.

The scroll to the first marked line runs only in onMount. A same-page change of hash from outside the line numbers won't scroll, and neither will an in-app navigation that reuses the component for another file. That is probably acceptable, but it is a gap.

Merged as 226da31