Skip to content

feat(cursor): add a step path easing so a caret jumps instead of gliding - #183

Merged
LeadcodeDev merged 1 commit into
mainfrom
feat/cursor-step-easing
Aug 12, 2026
Merged

feat(cursor): add a step path easing so a caret jumps instead of gliding#183
LeadcodeDev merged 1 commit into
mainfrom
feat/cursor-step-easing

Conversation

@LeadcodeDev

@LeadcodeDev LeadcodeDev commented Aug 12, 2026

Copy link
Copy Markdown
Owner

What

cursor draws a caret — a rounded vertical bar. cursor_style is metadata today: "default" and "pointer" render identically, as the source already notes.

Every path_easing it offered interpolated (linear, ease_out, ease_in_out), so a caret moving between two text fields slid across the gap and spent most of the transition outside any field. A text caret never does that — it holds a position and jumps.

Why it cannot be worked around in a scenario

auto_path_offset interpolates with a Catmull-Rom whose tangent reads waypoints[seg_idx + 2]. On a segment whose two endpoints are the same point — the obvious way to express "hold this position" — that neighbour still bends the curve:

p_prev = p1 = p2 = 336, p3 = 736
catmull_rom(t) = 336 - 200t² + 200t³     → -29.6 px at t = 2/3

So the caret swings ~30 px backwards before returning, mid-hold. Expressing a hold-then-jump without this easing takes four identical waypoints per stop — twelve for three fields — plus reasoning about click_duration short-circuiting the intermediate segments. That is a lot of scenario to say "don't interpolate".

step sets t = 0.0, and catmull_rom(0, …) returns p1 exactly whatever its neighbours are, so it is immune to this by construction.

How

CursorPathEasing::Step holds the departure waypoint for the whole segment; the move happens when time reaches the next waypoint and the segment changes. One match arm, no change to the existing easings, which stay the default — this is additive.

Tests

  • step holds the first waypoint across the segment and lands on the next
  • linear still interpolates (the addition does not change existing behaviour)
  • "step" parses from JSON in snake_case

Docs

SKILL.md lists the new value, and now says plainly that the component draws a caret and that cursor_style does not change the drawing — the table previously described it as "cursor appearance style", which reads as though it did.

cargo test --workspace green, cargo fmt --check and cargo clippy --all-targets clean.

cursor draws a caret — a rounded vertical bar — and cursor_style is metadata
today: "default" and "pointer" render identically. But every path_easing it
offered interpolated, so a caret walking between two text fields slid across
the gap and spent most of its time outside any of them. A text caret never
does that: it holds a position and jumps.

`step` holds the departure waypoint for the whole segment; the move happens
when time reaches the next waypoint and the segment changes. The interpolating
easings are unchanged and stay the default — this is additive, for the case
the component's own shape implies.

SKILL.md documents the new value, and says plainly that the component draws a
caret and that cursor_style does not change the drawing.
@LeadcodeDev
LeadcodeDev force-pushed the feat/cursor-step-easing branch from ffced7b to 5f59ffa Compare August 12, 2026 12:49
@LeadcodeDev
LeadcodeDev merged commit 1276989 into main Aug 12, 2026
3 checks passed
@LeadcodeDev
LeadcodeDev deleted the feat/cursor-step-easing branch August 12, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant