@brimveyn/aimux 1.14.7 → 1.14.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -330,6 +330,37 @@ export function TerminalPane({
|
|
|
330
330
|
)
|
|
331
331
|
const forwardScrollEvent = useCallback(
|
|
332
332
|
(event: OtuiMouseEvent) => {
|
|
333
|
+
// opentui's processMouseEvent dispatches a scroll to the deepest renderable
|
|
334
|
+
// (the <text> inside this box) BEFORE bubbling up to our handler.
|
|
335
|
+
// TextBufferRenderable's built-in onMouseEvent unconditionally calls
|
|
336
|
+
// handleScroll, which mutates its private _scrollY. preventDefault on the
|
|
337
|
+
// bubbled event can't roll that back — the scroll already happened. And
|
|
338
|
+
// nothing in React ever resets _scrollY for the lifetime of the renderable.
|
|
339
|
+
//
|
|
340
|
+
// Net effect: every wheel event over the terminal nudges the rendered
|
|
341
|
+
// text away from state.viewport.lines by one wheel step. The drift
|
|
342
|
+
// accumulates until the user refreshes aimux (re-mounts the text).
|
|
343
|
+
// Reset _scrollY here, right after the child finished scrolling.
|
|
344
|
+
const scrollTarget = event.target
|
|
345
|
+
if (scrollTarget !== null && typeof scrollTarget === 'object') {
|
|
346
|
+
const currentScrollY = Reflect.get(scrollTarget, 'scrollY')
|
|
347
|
+
if (typeof currentScrollY === 'number' && currentScrollY !== 0) {
|
|
348
|
+
try {
|
|
349
|
+
Reflect.set(scrollTarget, 'scrollY', 0)
|
|
350
|
+
} catch {
|
|
351
|
+
// Not all renderables expose a setter; best-effort only.
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
const currentScrollX = Reflect.get(scrollTarget, 'scrollX')
|
|
355
|
+
if (typeof currentScrollX === 'number' && currentScrollX !== 0) {
|
|
356
|
+
try {
|
|
357
|
+
Reflect.set(scrollTarget, 'scrollX', 0)
|
|
358
|
+
} catch {
|
|
359
|
+
// Not all renderables expose a setter; best-effort only.
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
333
364
|
if (!canForwardMouse && !canUseLocalScrollback) {
|
|
334
365
|
return
|
|
335
366
|
}
|