File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 11import React , { useRef , useState } from 'react'
22import stringWidth from 'string-width'
3+
34import { useTheme } from '../hooks/use-theme'
45
5- import type { AgentMode } from '../utils/constants'
66import type { ChatTheme } from '../types/theme-system'
7+ import type { AgentMode } from '../utils/constants'
78
89const getModeConfig = ( theme : ChatTheme ) =>
910 ( {
@@ -76,7 +77,7 @@ export const AgentModeToggle = ({
7677 openTimeoutRef . current = setTimeout ( ( ) => {
7778 setIsOpen ( true )
7879 openTimeoutRef . current = null
79- } , 250 )
80+ } , 0 )
8081 }
8182
8283 const handleMouseOut = ( ) => {
@@ -90,7 +91,7 @@ export const AgentModeToggle = ({
9091 closeTimeoutRef . current = setTimeout ( ( ) => {
9192 setIsOpen ( false )
9293 closeTimeoutRef . current = null
93- } , 1000 )
94+ } , 0 )
9495 }
9596
9697 if ( ! isOpen ) {
Original file line number Diff line number Diff line change 11import { Queue } from './arrays'
2+ import { logger } from './logger'
23import { clamp } from './math'
34
45import type { ScrollAcceleration } from '@opentui/core'
@@ -93,6 +94,7 @@ type QuadraticScrollAccelOptions = {
9394 rollingWindowMs ?: number
9495}
9596
97+ let lastTick = Date . now ( )
9698/** Estimates the scrolling speed based on the frequency of scroll events.
9799 *
98100 * The number of lines scrolled is proportional to the number of scroll events
@@ -114,7 +116,7 @@ export class QuadraticScrollAccel implements ScrollAcceleration {
114116 }
115117
116118 /** Calculates the average number of scroll events */
117- tick ( now = Date . now ( ) ) : number {
119+ tick ( now = Date . now ( ) , baseAmount : number = 1 ) : number {
118120 this . tickHistory . enqueue ( now )
119121
120122 let oldestTick = this . tickHistory . peek ( ) ?? now
@@ -123,6 +125,10 @@ export class QuadraticScrollAccel implements ScrollAcceleration {
123125 oldestTick = this . tickHistory . peek ( ) ?? now
124126 }
125127
128+ const dt = now - lastTick
129+ lastTick = now
130+ logger . info ( { } , `asdf tick ${ dt } ms ${ baseAmount } ${ this . tickHistory . length } speed` )
131+
126132 this . buffer += clamp (
127133 this . tickHistory . length * this . multiplier ,
128134 0 ,
You can’t perform that action at this time.
0 commit comments