Skip to content

Commit af3459c

Browse files
Remove Zed IDE-specific scroll acceleration
Simplify scroll behavior by removing IDE detection and custom scroll parameters. Standardize animation duration to 200ms and frame interval to 16ms across all environments. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
1 parent d1d6e5b commit af3459c

File tree

3 files changed

+5
-50
lines changed

3 files changed

+5
-50
lines changed

cli/src/hooks/use-scroll-management.ts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import { useCallback, useEffect, useMemo, useRef } from 'react'
1+
import { useCallback, useEffect, useRef } from 'react'
22

33
import type { ScrollBoxRenderable } from '@opentui/core'
4-
import { isZedIDE } from '../utils/detect-ide'
5-
import { ZedScrollAccel } from '../utils/zed-scroll-accel'
64

75
const easeOutCubic = (t: number): number => {
86
return 1 - Math.pow(1 - t, 3)
@@ -13,11 +11,6 @@ export const useChatScrollbox = (
1311
messages: any[],
1412
agentRefsMap: React.MutableRefObject<Map<string, any>>,
1513
) => {
16-
const isZed = isZedIDE()
17-
const scrollAcceleration = useMemo(
18-
() => (isZed ? new ZedScrollAccel() : undefined),
19-
[isZed],
20-
)
2114
const autoScrollEnabledRef = useRef<boolean>(true)
2215
const programmaticScrollRef = useRef<boolean>(false)
2316
const animationFrameRef = useRef<number | null>(null)
@@ -30,7 +23,7 @@ export const useChatScrollbox = (
3023
}, [])
3124

3225
const animateScrollTo = useCallback(
33-
(targetScroll: number, duration: number = isZed ? 400 : 200) => {
26+
(targetScroll: number, duration = 200) => {
3427
const scrollbox = scrollRef.current
3528
if (!scrollbox) return
3629

@@ -39,7 +32,7 @@ export const useChatScrollbox = (
3932
const startScroll = scrollbox.scrollTop
4033
const distance = targetScroll - startScroll
4134
const startTime = Date.now()
42-
const frameInterval = isZed ? 40 : 16
35+
const frameInterval = 16
4336

4437
const animate = () => {
4538
const elapsed = Date.now() - startTime
@@ -59,7 +52,7 @@ export const useChatScrollbox = (
5952

6053
animate()
6154
},
62-
[scrollRef, isZed, cancelAnimation],
55+
[scrollRef, cancelAnimation],
6356
)
6457

6558
const scrollToLatest = useCallback((): void => {
@@ -182,8 +175,6 @@ export const useChatScrollbox = (
182175
return {
183176
scrollToLatest,
184177
scrollToAgent,
185-
scrollboxProps: {
186-
scrollAcceleration,
187-
},
178+
scrollboxProps: {},
188179
}
189180
}

cli/src/utils/detect-ide.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

cli/src/utils/zed-scroll-accel.ts

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)