Skip to content

feat(text): El::link_cursor, the pointer's shape over a selectable text's links - #2121

Merged
Hona merged 5 commits into
devfrom
cursor/link-cursor
Nov 25, 2026
Merged

Hona merged 5 commits into
devfrom
cursor/link-cursor

Conversation

@Hona

@Hona Hona commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Compiled

Compiled on Windows x64, Windows arm64, macOS and Linux x64 in anomalyco/opencode-rune#1137, all four build jobs green: the app with Rune pinned to a check commit, the rev the app pins today (4d8df909) plus this change and the five other cursor changes, cherry-picked. That is this change on the app's rev, not on this branch's base (dev is 117 commits past it); every match on Cursor that dev has was checked by reading.

Not covered by that compile: dev changed the same condition while this was open (the hand now also shows over a link in text that sets no cursor of its own), so the merge of dev into this branch rewrote one expression in Runtime::cursor by hand. link_cursor names the shape in that case too.

Why

Over a link in selectable text the pointer always shows the hand. An app could not change it:

  • Runtime::cursor returns the hand for a link in selectable text before it looks at any element's cursor.
  • El::selectable takes the element's own cursor for the I-beam, so El::cursor cannot carry "the arrow over my links" either.

A web page can: a { cursor: default } gives a link that reads as plain text the arrow while the text around it keeps the I-beam. An app that matches such a page element by element showed a hand where the page shows the arrow (a URL in a tool's output, for one).

What changes

El::link_cursor(Cursor): the pointer's shape over this text's links while the text is selectable.

text(output).selectable(true).link(Link::new(range, url)).link_cursor(Cursor::Default)

What it can change for an app

Nothing until an app calls it:

  • The hand stays the default over a link in selectable text.
  • Text that is not selectable and sets a cursor is unchanged: its links show that cursor.
  • A text field's links keep the hand.
  • A text split into paragraphs by direction carries the setting to each paragraph (it is cloned with the text's other link fields).

Not run

The new test has not been run: this repo's tests run on the scheduled macOS job, which I read after the merge. a_selectable_texts_link_shows_the_hand_unless_link_cursor_names_another_shape covers the default, the override, and the I-beam beside the link in both.

Hona added 3 commits November 25, 2026 14:48
CSS help and progress: the arrow with a question mark and the arrow with a busy mark. winit has both (IDC_HELP and IDC_APPSTARTING on Windows, the theme's cursors on Linux, the CSS cursors on the web); on macOS the private AppKit selectors winit uses, behind respondsToSelector, else the arrow.
…or it shows

A top-level pointer object (at, cursor) and a cursor field on the one element the shape is read from, by CSS name. Runtime::cursor's choice of that element moves into cursor_origin, which cursor_path shares.
…xt's links

The hand over a link in selectable text was fixed in Runtime::cursor, ahead of anything the element set, and El::selectable takes the element's cursor for the I-beam. link_cursor names another shape; the hand stays the default.
@Hona
Hona marked this pull request as ready for review November 25, 2026 05:58
@Hona
Hona merged commit 86666db into dev Nov 25, 2026
1 check passed
@Hona
Hona deleted the cursor/link-cursor branch November 25, 2026 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant