Compare commits
1 Commits
v0.2.19-ma
...
v0.2.20-wi
| Author | SHA1 | Date | |
|---|---|---|---|
| b55de8d75e |
@@ -144,6 +144,8 @@ export default function TerminalView({ sessionId, active }: Props) {
|
|||||||
if (e.deltaY < 0) {
|
if (e.deltaY < 0) {
|
||||||
autoFollowRef.current = false;
|
autoFollowRef.current = false;
|
||||||
setIsAutoFollow(false);
|
setIsAutoFollow(false);
|
||||||
|
isAtBottomRef.current = false;
|
||||||
|
setIsAtBottom(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
containerRef.current.addEventListener("wheel", handleWheel, { capture: true, passive: true });
|
containerRef.current.addEventListener("wheel", handleWheel, { capture: true, passive: true });
|
||||||
@@ -154,7 +156,6 @@ export default function TerminalView({ sessionId, active }: Props) {
|
|||||||
const scrollDisposable = term.onScroll(() => {
|
const scrollDisposable = term.onScroll(() => {
|
||||||
const buf = term.buffer.active;
|
const buf = term.buffer.active;
|
||||||
const atBottom = buf.viewportY >= buf.baseY;
|
const atBottom = buf.viewportY >= buf.baseY;
|
||||||
const prevAtBottom = isAtBottomRef.current;
|
|
||||||
isAtBottomRef.current = atBottom;
|
isAtBottomRef.current = atBottom;
|
||||||
|
|
||||||
// Re-enable auto-follow only when USER scrolls to bottom (not write-triggered)
|
// Re-enable auto-follow only when USER scrolls to bottom (not write-triggered)
|
||||||
@@ -164,14 +165,11 @@ export default function TerminalView({ sessionId, active }: Props) {
|
|||||||
setIsAutoFollow(true);
|
setIsAutoFollow(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only update React state when value changes
|
if (scrollStateRafId === null) {
|
||||||
if (atBottom !== prevAtBottom) {
|
scrollStateRafId = requestAnimationFrame(() => {
|
||||||
if (scrollStateRafId === null) {
|
scrollStateRafId = null;
|
||||||
scrollStateRafId = requestAnimationFrame(() => {
|
setIsAtBottom(isAtBottomRef.current);
|
||||||
scrollStateRafId = null;
|
});
|
||||||
setIsAtBottom(isAtBottomRef.current);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user