Skip to content

feat(tooling): the tree dump says where the pointer is and which cursor it shows - #2117

Merged
Hona merged 2 commits into
devfrom
cursor/tree-cursor
Nov 25, 2026
Merged

Hona merged 2 commits into
devfrom
cursor/tree-cursor

Conversation

@Hona

@Hona Hona commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Stacked on #2116 (css_name names every variant, so the two land in order).

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.

Run

On that build (Windows x64), 37 stops in a real window (a session, its tool rows, Settings): the tree's pointer.cursor read headless, one run per stop, beside the cursor the window's own thread set. They agree at all 37: default with the arrow (29), text with the I-beam (6), pointer with the hand (1), not-allowed with the no-entry cursor (1). The element that carries cursor is the stop's own element, or the pressable row it sits in.

Why

A headless run could not read the cursor: --tree wrote every element's rect, role and paint, but not the pointer's shape. The only way to check a cursor was a real window and the OS cursor its thread set. A pin bump's walk, or an app's own check that a control shows the arrow, needs this without a window.

What changes

--tree (and a hot snapshot's JSON, which is the same dump) gains two things:

  • pointer, at the top level, once the pointer has been somewhere: { "at": [x, y], "cursor": "<name>" }. cursor is Runtime::cursor() by its CSS name: default, pointer, text, grab, grabbing, not-allowed, move, col-resize, row-resize, ew-resize, ns-resize, nwse-resize, nesw-resize, crosshair, cell, zoom-in, zoom-out, help, progress, none (Cursor::Hidden), image (an app's own picture).
  • cursor on one element: the one the shape is read from. That is the pressed element while a gesture holds the pointer (the text that holds the selection while a drag selects), else the hit target under the pointer.

What an element with no cursor of its own reports: the nearest ancestor's cursor, else default. It is the value the shell shows, not the element's own setting. No other element carries the field. Outside the window, over no element, and while a middle-click autoscroll pans, no element carries it; pointer.cursor still says what shows (default, or image for the pan picture).

Runtime::cursor's choice of that element moves into cursor_origin, shared with the new cursor_path. Its result is unchanged.

What it can change for an app

Nothing an app draws. A tool that reads --tree and rejects unknown keys would see pointer and, on one element, cursor.

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. tree_json_reports_the_pointer_and_the_cursor_on_the_element_it_is_read_from covers: no pointer before a move, a handle with its own cursor, and a pressable element with none (default).

Hona added 2 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.
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