(s: ScrollBoxHandle, delta: number)
| 832 | // Target is relative to scrollTop+pendingDelta so a jump mid-wheel-burst |
| 833 | // lands where the wheel was heading. |
| 834 | export 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 |
no test coverage detected