Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/guides/05-events-and-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ cells. `mousedown` moves focus, and `wheel` scrolls.
Each wheel notch scrolls three lines. There's no context menu; the
right button is an ordinary press.

A link's text is painted as a terminal hyperlink (OSC 8) when its `href`
resolves to an absolute `http`, `https` or `mailto` URL, so a terminal
that supports them opens it on its own modifier-click or hover, whether
or not the page has the mouse. The engine never follows a link itself; a
`click` listener is where an app acts on one.

```ts
row.addEventListener("click", () => open(row.dataset.path!));
```
Expand Down
19 changes: 19 additions & 0 deletions src/internal/cssom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7795,6 +7795,17 @@ const LIST_NUMBERING_ATTRIBUTES = new Set([
"type",
]);

// Past the cap a restyle keeps, the next frame repaints whole.
function repaintLink(cascade: Cascade, element: Element): void {
const restyled = cascade.layout.restyledForPaint;
if (restyled.size >= 256) {
restyled.clear();
cascade.layout.invalidateFrame();
return;
}
restyled.set(element, null);
}

// What one batch of records has done, for the work that waits until
// the batch ends.
interface MutationBatch {
Expand Down Expand Up @@ -8187,6 +8198,14 @@ function handleAttributeMutation(
noteCounterChange(cascade, element);
cascade.layout.invalidateFrame();
}
// A link paints its URL into its cells apart from its style, so its
// rows repaint whatever the sheets make of the change.
if (
mutation.attributeName === "href" &&
(getLocalName(element) === "a" || getLocalName(element) === "area")
) {
repaintLink(cascade, element);
}
// A change to keys whose rules declare only paint properties
// leaves every box where it was. The styles are dropped so the
// next read resolves them, and layout is not told.
Expand Down
Loading