Skip to content

Commit 7c3e52c

Browse files
committed
add logging for baseAmount
1 parent ef88db0 commit 7c3e52c

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

cli/src/components/agent-mode-toggle.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React, { useRef, useState } from 'react'
22
import stringWidth from 'string-width'
3+
34
import { useTheme } from '../hooks/use-theme'
45

5-
import type { AgentMode } from '../utils/constants'
66
import type { ChatTheme } from '../types/theme-system'
7+
import type { AgentMode } from '../utils/constants'
78

89
const 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) {

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Queue } from './arrays'
2+
import { logger } from './logger'
23
import { clamp } from './math'
34

45
import 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,

0 commit comments

Comments
 (0)