Skip to content

Conversation

@josstei
Copy link
Member

@josstei josstei commented Feb 8, 2026

Summary

  • Cursor trail system: Renders a fading trail of highlight segments behind cursor movement using extmarks and a ring buffer renderer
  • Policy abstraction layer: Three built-in policies (always, never, distance) filter trail visibility based on movement type and distance, reducing visual noise on trivial motions (hjkl single-line moves)
  • Resolution chain: User config overrides > motion-level policy > category default > always fallback, giving full control over trail behavior per-motion

What Changed

Trail Core (renderer, highlights)

  • Ring buffer position tracking with configurable segment count (2-12)
  • Color blending from trail color to background with linear fade
  • Auto-resolves trail color from Cursor highlight group
  • Extmark-based rendering with boundary clamping

Policy System

  • always - unconditionally shows trail
  • never - unconditionally hides trail
  • distance - shows trail only when movement exceeds configurable line/column thresholds
  • Policy registry with resolve() implementing the full resolution chain
  • Config validation for policy, distance thresholds, and per-motion overrides

Motion Integration

  • All motions assigned trail_policy: distance for hjkl/gj/gk, always for everything else
  • invoke_start now passes result to traits for policy evaluation
  • motion_id attached to context for policy resolution

Config Defaults

  • Cursor trail: enabled, distance policy, min_lines=2, min_cols=5
  • Scroll trail: disabled, always policy

Test Plan

  • 583 tests passing (100% pass rate)
  • 64 new tests covering all policy files, registry, config, and integration
  • Backwards compatibility: existing trail integration tests unchanged and passing
  • Edge cases: zero movement, backward movement, missing cursor, unknown policies

- Default trail color is now "auto" (reads from Cursor highlight group)
- Intensity curve starts at 1.0 with gentler (1-t)^1.2 decay
- Add resolve_color() to highlights module for runtime color resolution
- Update validation to accept "auto" as valid trail color
- Linear intensity curve (1-t) for uniform color steps between segments
- Increase default segments from 6 to 8 for smoother gradient
Introduces a policy abstraction layer between motion execution and trail
rendering to filter trail visibility based on movement distance and
motion type.
Three built-in policies for filtering trail visibility:
- always: unconditionally enables trail
- never: unconditionally disables trail
- distance: enables trail only when movement exceeds configurable thresholds
…its signature

- Policy registry with resolution chain: user override > motion > category > always
- Config defaults: cursor uses distance policy, scroll uses always
- Validation for policy, distance thresholds, and overrides
- All builtin motions assigned trail_policy (distance for hjkl/gj/gk, always for rest)
- invoke_start now passes result to traits, motion_id attached to context
Trail trait now evaluates policies at animation start via on_start.
Policies are registered during setup (always, never, distance).
Trail rendering is gated by context.trail_active flag.
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