mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-09-21 16:02:20 +00:00
* feat(terminal): animate wheel scrolling instead of jumping a notch at once Sub-line scroll positions were already in place — the view keeps a fractional remainder and paints the grid shifted by it — but the position was a function of the event, not of time. A notch arrived and the whole distance was applied at once, so whether it looked smooth came down to how fine-grained the platform's deltas happened to be. A macOS trackpad reports pixels, so it did. A wheel on Windows reports whole lines (gpui multiplies the notch by the system's scroll-lines setting, three by default), the fraction came out zero every time, and the view jumped three lines per notch. The sub-line machinery was present and never engaged. A 120-step notch is one discrete pulse; no arithmetic on the delta recovers a continuous gesture from it. So make position a function of time: a notch adds to a remaining distance and each frame consumes a share of what is left, ~120ms to land, exponential, with a sub-pixel remainder snapped rather than approached since every frame of it costs a repaint. Line deltas are discrete and get animated; pixel deltas are continuous and do not — putting an animation between a trackpad and the grid would only add lag. Mouse reporting and alternate-scroll keep forwarding whole lines, which cannot be spread over frames either. The distance in flight is relative rather than an absolute target, so output arriving mid-scroll shifts the grid without dragging the animation elsewhere. Everything that moves the view on its own cancels what is in flight first. Settings -> Terminal -> Scrolling -> Smooth scrolling, on by default. Also pin the scratch config dir in the terminal-view test harness: building a view reads the config, and which test got there first decided whether that touched the real user directory. * fix(terminal): tell a trackpad from a wheel by phase, not delta type The first cut split the two on the delta variant — Lines meant a wheel, Pixels meant a trackpad. That holds on Windows and Linux. It does not hold on macOS, which sets hasPreciseScrollingDeltas for a wheel mouse as well, so a wheel reported pixels, took the trackpad path, and was never animated. Measured on this machine, one detent arrives as a single ~103px event — about five lines at a 21px line height, applied in one go. That is a worse jump than the three lines Windows produced, and it was invisible to a check based on the delta's type. Size cannot separate them either: a trackpad flick reaches ~3 lines in one event while an inched wheel moves ~0.6, so the ranges overlap and any threshold misclassifies a quarter of the trackpad stream. Phase can. Only a device that can gesture ever reports Started/Ended; a wheel is Moved forever, on every backend. So track the gesture instead — and hold it open on a 150ms idle timer rather than closing it on Ended, because lifting the fingers is not the end of the stream: the momentum tail keeps delivering Moved events larger than the gesture that spawned them, and animating those would smooth what the system already smoothed. Also skip the animation for jumps under a line. Inching a wheel one detent at a time lands there, and spreading a half-line move only adds lag to something that already reads as continuous. Tests are now shaped after the measured event streams rather than after an assumption about which variant each device sends. * chore: trigger a Claude review of this branch --------- Co-authored-by: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com>