Sticky top-line (pinned user message) flickers backward to an older message while scrolling the transcript

Status Open
Reported on v2.1.215
Maintainer reply None cached
Activity 0 comments · opened Jul 22, 2026

Environment:

  • Claude Code 2.1.215 (also present through the latest 2.1.216), terminal TUI
  • macOS (arm64); reproduces with trackpad / mouse-wheel (momentum) scrolling

Description:

When you scroll up through a long conversation, Claude Code pins the current section's user message on the dimmed top line (clickable to jump). As you scroll down, that pinned line is supposed to advance forward to newer user messages. Instead, mid-scroll it intermittently flips backward to an older user message for a frame or two, then corrects. It only happens during continuous / momentum scrolling, not single-line arrow-key scrolls.

Steps to reproduce:

  1. Open a session with many user turns (claude --resume on a long transcript).
  2. Scroll up well into history.
  3. Scroll down slowly and continuously using a trackpad or mouse wheel (momentum scroll).
  4. Watch the dimmed pinned message on the top line.

Expected: The pinned message changes monotonically - only advancing forward as you scroll down (and backward as you scroll up).

Actual: During the down-scroll the pinned message occasionally jumps backward to a previous user message, then forward again - a visible backward flicker.

Likely cause (from inspecting the bundled source):

The component that selects which user message to pin recomputes it on every scroll notification from the instantaneous scroll geometry - the effective scroll top is getScrollTop() + getPendingDelta() (the target, which overshoots during a momentum animation) compared against item tops that reflect the current (lagging) layout, and it also accepts messages that have been virtualized out of the render window (unmeasured tops). There is no guard that the selection can only move in the scroll direction, so these transient inconsistencies briefly resolve to an earlier message. A direction-monotonicity guard (only allow the pinned index to advance while scrolling down / retreat while scrolling up) resolves it cleanly.

View original on GitHub ↗