MCPcopy
hub / github.com/codeaashu/claude-code / jumpBy

Function jumpBy

src/components/ScrollKeybindingHandler.tsx:834–847  ·  view source on GitHub ↗
(s: ScrollBoxHandle, delta: number)

Source from the content-addressed store, hash-verified

832// Target is relative to scrollTop+pendingDelta so a jump mid-wheel-burst
833// lands where the wheel was heading.
834export function jumpBy(s: ScrollBoxHandle, delta: number): boolean {
835 const max = Math.max(0, s.getScrollHeight() - s.getViewportHeight());
836 const target = s.getScrollTop() + s.getPendingDelta() + delta;
837 if (target >= max) {
838 // Eager-write scrollTop so follow-scroll sees followDelta=0. Callers
839 // that ran translateSelectionForJump already shifted; scrollToBottom()
840 // alone would double-shift via the render-phase sticky follow.
841 s.scrollTo(max);
842 s.scrollToBottom();
843 return true;
844 }
845 s.scrollTo(Math.max(0, target));
846 return false;
847}
848
849// Wheel-down past maxScroll re-enables sticky so wheeling at the bottom
850// naturally re-pins (matches typical chat-app behavior). Returns the

Callers 2

ScrollKeybindingHandlerFunction · 0.85
applyModalPagerActionFunction · 0.85

Calls 2

maxMethod · 0.80
scrollToBottomMethod · 0.45

Tested by

no test coverage detected